function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Preeti ShettyPreeti Shetty 

Add to campaign button to update contact fields

Hi All,

In contacts I have two custom text fields called Secondary Source and opportunity Source. When I add the contact to a campaign I want the secondary source to be populated to the name of the campaign and Opportunity Source to be populated to the field campaign type (which is picklist field). Everytime I add the contact to a new campaign the source field should get updated. Is this possible??
Santosh Kumar Sriram_2310Santosh Kumar Sriram_2310
Hi Preeti,

We cannot cross object field updates on Campaign member object. So the only solution, which I believe is a trigger on Campaign Member object, where you check for the contact and associate the values.

When a contact is added to a campaign, then it is an insert on the campaign member object. So a trigger would suffice.

Hope this helps!
Preeti ShettyPreeti Shetty
can you help me with the trigger.. I dont know how to write a trigger for this.