You need to sign in to do that
Don't have an account?
snakecow2000
Before Insert Trigger on Events
I am attempting to create a Before insert trigger which concatenates the Account name on the end of the Subject. Here's my code:
/* Adds additional text to the entered Subject */
trigger triggerAddSubject on Event (before insert)
{
Account subjectacct = [select Id, Name from Account where Id = :Trigger.new.whoid];
Trigger.new.subject = Trigger.new.subject + ' ' + subjectacct.name;
} // end of trigger
trigger triggerAddSubject on Event (before insert)
{
Account subjectacct = [select Id, Name from Account where Id = :Trigger.new.whoid];
Trigger.new.subject = Trigger.new.subject + ' ' + subjectacct.name;
} // end of trigger
If I hard code an account guid into the query it works fine, apparently the whoid isn't set until the record is committed, so the subjectacct is null.
Have I just written it incorrectly or do I need to rewrite this as a after insert trigger?
Is there an easier way to do it?
Thanks,
Thanks,
Pat
i ahve most of what i need i am jsut finding that the whatId is coming up with a null value
It seems like from printing out values for the red are both null and therefore the rest isn't processing.
the green is printing correctly