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
Admin_dev.ax1029Admin_dev.ax1029 

Automatically Adding a Primary Campaign Source to Opp based on Primary Contact Role

SF is setup so that when you convert a lead to an opportunity, the opportunity will automatically get a primary campaign source based on the most recent campaign that lead was associated with. SF also populates a PCS when creating an opportunity from a contact.


I am looking if it is possible to get the most recent campaign from the primary contact role from opp and assign this campaign to the primary campaign source field in Oppty if this field is null.

 

Is this something that could be done with APEX triggers?