+ Start a Discussion
dcarmen6dcarmen6 

Primary Campaign Source on Opportunities created through Apex

When you start off with a Contact that's associated with one or more campaigns, when you create a new Opportunity from the related list on the Contact the Campagin Influence is set on the Opportunity, and one of the campaign members is chosen as the Primary Campaign Source. I have Apex code that creates the Opportunity and links in the Opportunity Contact Role. When I create the Opportunity through the code, the Primary Campaign Source is NOT set. I know you can set the CampaignId on the Opportunity and that will make the Campaign the Primary Campaign Source, but it will not make the Campaign Member the Primary. I know there's not really a way through code to set the Primary Source on the campaign member, but does anyone know why it does not set a Primary Source when I don't set the CampaignId on the Opportunity creation?
dcarmen6dcarmen6
Thanks - that's the API documentation but it doesn't answer my question about the Primary Campaign Source.