0

I'm trying to automate creating Opportunity Contact Roles when an Opportunity is created, and I'm not having any difficulty creating these. What I'm struggling with is, in the case when an Opportunity is created via Lead conversion or from the Contact page, a Contact Role is automatically generated.

I understand that the parent record (Opportunity) must be created before the Contact Role is created, but is there some way, from the Opportunity, to detect whether a Contact Role is going to be created as part of the transaction?

I thought the mysterious ContactId field on Opportunity might be helpful, but this is null in both an after insert trigger and in a record-triggered Flow (after save). I could just make this all fire asynchronously and wait for the Contact Role to be inserted, but surely there must be something that indicates this behind the scenes.

1

In all of my research, I've found that the answer appears to be "no." There's simply no flag or other field you can use to reliably detect this duplicate. The Opportunity Contact Role is created during the transaction finalization, long after your triggers execute. Asynchronous is probably your best option to avoid this problem.

1
  • I was worried this might be the answer, but thanks for confirming. – Todd Sprinkel Feb 3 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.