You need to sign in to do that
Don't have an account?
Rogerio Lara 2028
Apex Trigger to create a child record when a new parent record is created.
I need to create a child record when a new parent record is created.
I am trying to create an Apex trigger that creates or forces a child record to be created when a new parent record is created, but unfortunately isn't working :-(
I'm getting this error message: Error: Compile Error: Expression cannot be assigned at line -1 column -1
Please, I would really appreciate any help. ;-)
Thank you,
Rog
I am trying to create an Apex trigger that creates or forces a child record to be created when a new parent record is created, but unfortunately isn't working :-(
trigger CreateBuyingInfluence on Opportunity_Positioning__c (after insert) { List<Buying_Influence__c> Childs = new List<Buying_Influence__c>(); for(Opportunity_Positioning__c a : trigger.new) { Buying_Influence__c Child = new Buying_Influence__c (); Child.SCOP__c = a.id; Buying_Influence__c.Name = 'testName'; Childs.add(Child); } insert Childs; }
I'm getting this error message: Error: Compile Error: Expression cannot be assigned at line -1 column -1
Please, I would really appreciate any help. ;-)
Thank you,
Rog
Line 10 looks incorrect. It should look like this:
Child.Name = 'testName';
That should work!