You need to sign in to do that
Don't have an account?

Unable to Assign userid
I am writing a trigger that will return the user full name to a custom lookup field to the username. The problem is that i cannot pick up the lead.ownerid when add/update a campaign member from the lead record or the conttact record. Below is the start of the trigger.
trigger cmOwner on CampaignMember (Before Insert, Before Update) { Set<Id> lIds = new Set<Id>(); Set<Id> cIds = new Set<Id>(); for(CampaignMember cm : Trigger.new) { System.debug('**** 1 lIds id : '+cm.lead.ownerid); LIds.add(cm.lead.ownerid); cIds.add(cm.contact.ownerid); System.debug('**** 2 lIds id : '+cm.lead.ownerid); } list<user> lUs = [select id, FirstName, LastName from user where id in :lids]; }
Although the trigger is set to run whenever a campaign member record was created or updated, no records are added to sets when i create or edit a campaign member record. Why are the records not entering the trigger?
Thank you,
ckellie
Hi
You need to write the trigger for after insert,after update to get the id.
Thanks
All Answers
Hi
You need to write the trigger for after insert,after update to get the id.
Thanks
Thank you very much.