When you mark a Contact as primary while adding it as Opportunity contact role in Lightning, It allows to save even without assigning a role to the primary Contact. When we try the same thing in Classic, the error message comes up and does not allow to save.

How we can bring the same functionality in Lightning?


I don't think there's much you can do here, as per the usual with Opportunity Contact Role. Since there's no triggers or validation rules on that object, you don't have any real-time chance to intervene in the transaction.

You're stuck then with either (a) Scheduled Apex to locate and remedy those records; or (b) observing in real time with Change Data Capture, which does support OpportunityContactRole.

The only route I can see, and it's a tricky one, would be a component on the Lightning record page for Opportunity that listens for change data capture events for Contact Roles on its own Opportunity. It could then post a Toast message, open a modal, or even set a flag on the Opportunity itself to prevent it from saving. But that's a lot of work (with pre-release technology!) and it wouldn't buy you a guarantee of data integrity since it's purely reactive in the UI layer.

Lots of good Idea Exchange posts to vote up on Opportunity Contact Roles, although I don't see this specific one among them:

  • Thanks for your answer. I have raised a case with salesforce about it. I will update soon. – sanket kumar Jan 10 at 17:06

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.