You need to sign in to do that
Don't have an account?
tengel
Detail record creation trigger failing
Hi all,
I've been pouring over the boards here trying to figure out why I can't get my trigger to create a detail record on master record creation.
Master Record = Policy__c
Detail Record = Transaction__c
Error message when trying to save trigger:
Error: Compile Error: Incorrect SObject type: Policy__c should be Transaction__c at line 1 column 1
Trigger code:
trigger createTransaction on Policy__c (after insert) { List<Transaction__c> addTA = new List<Transaction__c>(); for (Policy__c p : Trigger.new) { Transaction__c t = new Transaction__c(); t.Related_Policy__c = p.Id; addTA.add(t); } insert addTA; }
I sincerely appreciate any guidance.
Did you accidentally create the trigger on the Transaction__c object instead of the Policy__c object? Try creating a new Trigger, only make sure that it is on the Policy__c object.
All Answers
Did you accidentally create the trigger on the Transaction__c object instead of the Policy__c object? Try creating a new Trigger, only make sure that it is on the Policy__c object.
Arrrrrrrrrrrrgggggggghhhhhhhhh!
Can you tell I'm a noob?
Thank you for your response, my first trigger is working!