CRMJobs.net Homepage
Candidates
 
Employers
My Home  | Job SearchBrowse JobsCompany ProfilesCareer CenterHelpAbout Us |  Contact
SFDC Trigger, how to add values into the current record in after insert

CRM Applications Discussions


Reply SFDC Trigger, how to add values into the current record in after insert From:
GuestUser
SFDC allows adding values in Before Triggers, but if you need to associate a child, you will need the record id. from this new record. So you try to use After Insert, here you will get id of the record.
HOWEVER SFDC has a locking mechanism NOT to Allow to Insert any values in After Insert runniing Trigger. Bummer!
Of course, you may use a the before insert trigger but no IDs :(.
Below is very cool approach to REQUERY this record while you are on that record! It is tested.
Other approach is to create a copy of the record, not tested.
Below is requery option: You use any other Object instead of Account.:)
Example: Inside After Insert

Account myAccount=trigger.new[0]; //Any object
Account updacc=[select id from account where id = :myAccount.id]; //Query
updacc.type='Enterprise Customer'; //Add!
update updacc;

click to view
Replies to this message: 
-None-
Login | Submit Resume | Job Search | Contact | Terms/Privacy

About Us | Site Map | Partners | Link To Us |

Copyright 2003 - CRMJobs.NET - All Rights Reserved.