Add Opportunity Contact Roles on Opportunity Update
We're sending an email campaign through Pardot excluding customers who placed an order with us or prospects whom we provided Customer Quotation (SCM Module by Financial Force) within the past 30 days. To exclude this list, we must sync Salesforce Opportunity to Pardot Opportunity. Pardot opportunity is tied to a prospect where Salesforce Opportunity is not directly tied to contacts but through Accounts and OpportunityContactRoles. In order to sync Salesforce Opportunity with Pardot Opportunity, OpportunityContactRoles must be created in Salesforce Opportunity. When a Salesforce lead is converted (creating an account, contact, and opportunity), OpportunityContactRoles are automatically created. Similarly, when a new Salesforce Opportunity is created OpportunityContactRoles are automatically created (via traversing Opportunity -> Account -> Contact). However, when a new contact is added to an Account within Salesforce; the new OpportunityContactRole is not automatically created. To exclude those newly added contacts to be excluded, we must run the one-time script via Developer Console to add OpportunityContactRole.