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
prathibha s 3prathibha s 3 

Opportunity Amount splitted equally to all the influenced campaigns

Hi

I need to equally split the Amount value of opportunity to all the influenced campaigns. So that each campaign receives the appropriate credit. Currently in SFDC, the whole opportunity amount is received only by *Primary Campaign Source*. I want to write a trigger for this, but it seems that the related list on Opportunities for "Campaign Influence" is not available through the API or Apex. So how can I achieve this if I am not able to fetch the Campaign Influence records of opportunity?

Please suggest if there is any workaround for this.

Thanks!
Prathibha

 

NagaNaga (Salesforce Developers) 
Hi Prathibha,


You could create a junction object that links all influencing campaigns with the opportunity. This effectively creates a many to many relationship. Sort of how the campaiogn members object works. You could do a Master detail from junction object, so you could do a roll-up summary on opp that counts the # of influencing campaigns, then a formula field on the junction that divides the Opp Amount$ by number of influencing campaigns. You'd then have to use a report to summarize these values.


Best Regards
Naga Kiran
prathibha s 3prathibha s 3
Hi Naga,

Thanks for your reply, I found similar answer with some previous posts, but as per above solution I can get the splitted amount on junction object formula field. But how could I assign this amount to all the corresponding campaigns in campaign influence section of opportunity? Please correct me if I am missing somewhere!