As Salesforce has no native function to merge Opportunities I'm looking into creating my own. I'm comfortable with the field mapping/child records (products, activities, attachments etc) but the one object I'm stuck with is Campaign Influence.

Here are the potential scenarios I can think of:

1. Neither oppo has a primary campaign source

Great do nothing

2. Only oppo to keep has a primary campaign source

Great do nothing

3. Only oppo to delete has a primary campaign source

Great update Oppo to keep

4. Both have a primary campaign source

What if both have more than one...how can I tell if there is more than one???

We have no api access to Campaign Influence (vote here! https://success.salesforce.com/ideaview?id=087300000006n77AAA) ...the only way I can see to add a campaign influence is via an update to the oppo field "Primary Campaign Source". Now the issue with scenario 4 is I can't tell how many Campaign Influence records there are (plus the horrible need to update the oppo to keep multiple times).

Is there a way to handle this without writing my own campaign influence functionality?

1 Answer 1


Whilst you cannot read/write the Campaign Influence directly, you can mess with it indirectly via the Contact Roles.

The Contacts have their Campaign associations and those drive the Campaign Influence on the Opportunity. The Primary Contact Role gets to determine the Opportunity Primary Campaign Source.

So I would copy the Contact Roles from the Opportunity that you plan to delete into the one you plan to keep. Indirectly, that will bring over the Campaign Influence.

Quite what you should do when the Primary Campaign Source clashes is a business decision. You can write to that field so, as long as the business knows what it wants (and you write it after updating the Contact Roles), that part is easy.

  • Thanks that's helpful to be aware of but wouldn't always work, the org I'm working in at the moment can have an Opportunity associated to multiple Campaigns and won't always have a Contact Role (and then the Contact Role may or may not be associated to a Campaign).
    – Girbot
    Jun 29, 2015 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .