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.