0

Is it possible to create a custom Visualforce page for adding a new Opportunity Contact Role using standard controllers (Opportunity controller in this case)? The reason I'm asking is that I'd like to avoid writing any code for a custom controller.

The objective for the custom VF page is to make "isPrimary" field required when adding a new Opp Contact Role, which is not something that comes out of the box in Lightning Salesforce (different from classic).

Many thanks in advance

0

You can create a page for this, but there's no way to override the New Contact Role page. So, you'd have to hide the Contact Role Related List and build everything custom, such as adding a custom button for viewing/adding/removing roles. This is probably a lot more work than you'd bargained for. You may as well write this off as a training issue.

0

What we did was we got rid of the "new" button on the opportunity tab from the list view layoouts, and from the related list on the account object; then overrode our opportunity tab with a VF page:

<apex:page showHeader="true" tabstyle="Opportunity"> 
    <apex:ListViews type="Opportunity" /> 
</apex:page>

We then required users to create opportunities directly from the contact page instead of other possible sources. This means there is always a primary contact.

I should add I did not create this solution but it works pretty well. I know we also have a trigger on opportunity (since you can't have one on OCR) that does some roll-ups and populates a "primary contact" field on the opportunity, not sure if that is what you're looking for but does require apex.

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.