+ Start a Discussion
its chanteeits chantee 

Trigger

Hi to All
 
I Have one doubt  whenever  we create a record on Account Object , while we enter the Billing Address Field Value  , The same Value as display the Mailing Address Without Clicking the Copy Billing Address to Shipping Address
I Done By using Triggers  by using Before Insert  Event it working
But I want it By using  After Insert Event Can Plse suggest  and give me Explanation also
 
Best Answer chosen by its chantee
Sfdc CloudSfdc Cloud
Hi Chantee,

You have done it in using right approach.In before insert we can manipulate the value of record but in case of after insert we are not allowed to do that.We can achieve it using update DML operation on after insert Trigger.

Please refer Salesforce guide 
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_triggers.htm|StartTopic=Content%2Fapex_triggers.htm|SkinName=webhelp


if this answer helps,please mark it as best answer to help others:)
Thanks,

 

All Answers

Navee RahulNavee Rahul

The difference we use after and before insert ,if we use before insert then we could change or manipulate the values of the fields datas thats submitted.

in after we cannot do so,it would be like update.

in trigger if you are editing the record field you can compare the old values using trigger.old() please refer.

 

Thanks
D Naveen Rahul.

Sfdc CloudSfdc Cloud
Hi Chantee,

You have done it in using right approach.In before insert we can manipulate the value of record but in case of after insert we are not allowed to do that.We can achieve it using update DML operation on after insert Trigger.

Please refer Salesforce guide 
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_triggers.htm|StartTopic=Content%2Fapex_triggers.htm|SkinName=webhelp


if this answer helps,please mark it as best answer to help others:)
Thanks,

 
This was selected as the best answer
its chanteeits chantee
Thanks for your valuable information