I would like to create a record for another custom object (EMC_Task__c), upon creation of a Strategy record (noted above).
I have been trying to manipulate existing code, but I am getting a lot of Syntax errors.
Any help would be appreciated.
Thank you!
4 Antworten
Goto the Object --> on Trigger Section of the object detail --> click new might look like this
difference between before and after trigger
http://hisrinu.wordpress.com/2011/05/17/difference-between-before-trigger-and-after-trigger/
Trigger MyCustomTriggerName on Strategy__c (after insert)
{
// You need to bulkify the code : expect more than one record coming into the trigger at one point of time
List<EMC_Task__c> ts = new List<EMC_Task__c>();
for(Strategy__c s:Trigger.new)
{
EMC_Task__c t = new EMC_Task__c ();
t.yourField__c = 'Some values';
ts.add(t);
}
// inserts all the EMC Tasks in the collection
insert ts;
}
If this answers your question, please mark it as solved so that it may help others who're looking for the solution