You need to sign in to do that
Don't have an account?
kitsunebrave
How to Include a list of elements from a trigger
Hi,
I would like to pass a list of attributes from an SObject inside the after insert trigger.
Below is my code:
I would like to pass a list of attributes from an SObject inside the after insert trigger.
Below is my code:
trigger Milestone_Tasks_Creation_Trigger on Milestone1_Milestone__c (after insert) { List<Milestone1_Task__c> tasks = new List<Milestone1_Task__c>(); List<String> names = new List<String>{'Charter', 'Discovery', 'Impact Analysis', 'Design', 'Risk Assessment/Contigency Plan', 'User Acceptance Testing', 'Producition Approval', 'Survey'}; for(Milestone1_Milestone__c milestone : Trigger.New){ //Milestone1_Milestone__c milestone = Trigger.New; // Filling out Apporval Task:Impact, test, all rest //for example: Milestone1_Task__c task = new Milestone1_Task__c(Milestone1_Milestone__c = milestone.ID); task.Name = names; task.Complete__c = false; task.Priority__c = '0'; tasks.add(task); } insert tasks; }
NOTE: This code has not been tested and may contain typographical or logical errors
Thanks for your quick answer.
The final answer is that I was reviewing Milestone PM open source project, to include after insert trigger a Milestone PM Object with all Tasks. The Object itself milestone cannot reproduce any tasks inside, so I already created it this functionality but from existing Id. The version of my code had been tested 64% CO using specific Id from another Object created but I need to build automatic process to run milestone with tasks automatically. See below details, I included this Id, but I need this snippet capable to create without request an existing Id but the current Milestone Id after inserted.
Thanks pcon.