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
Ross Hopkins 8Ross Hopkins 8 

How to utilise Flow Designer to insert into OpportunityContactRole from a custom Master/Detail relationship

Hi,
I'm having an issue inserting into OpportunityContactRole from another custom object in Flow Designer. This is required to link Opportunities in Salesforce to related Prospect records in Pardot.

The data objects involved in this scenario are Opportunity and a related custom object called Applicant. There may be 1 or more Applicants related to one Opportunity. My objective is to insert a row into OpportunityContactRole for each Applicant.

Applicant is setup as follows:
Applicant Custom Object

I have a Process Builder Workflow that calls a flow depending on a criteria. This step is working as expected. I pass an OpportunityID parameter into the flow.
In the flow, the first thing I do is perform a Fast Lookup to retrieve all Applicants linked to an Opportunity. This lookup looks like this:

User-added image
Before I go into more detail, is this correct? I have assumed the Application__c variable is an OpportunityID but I have my doubts whether this is the case?
Subsequent steps loop through the retrieved array (sobject variable) of Applicants and insert a record into OpportunityContactRole. However, that will not work if I'm not looking up the Opportunity correctly.
Any advice appreciated. I appreciate that rather than having the Applicant custom object in the first place it would've been easier to soley use OpportunityContactRole with a new role of Applicant but I'm not permitted to make that change.
Thanks,
Ross