[SalesForce] Require Contact Role on all newly created Opportunities

I'm trying to come up with a way to require every new Opportunity to have a Contact Role associated with it upon creation. The issue I'm running into is the stupid "Recently Viewed" Opportunity List View. It's the only place left that would allow a user to create an Opp without associating a Contact Role. I have a VF page that redirects the user to an error message when trying to create an Opp using this method. 

<apex:page standardController="Opportunity">
     Please create this Opportunity from the associated Contact.
</apex:page>

This works great, except when I now create an Opportunity frome the Contact, there is for some reason no associated Contact Role on the Opp. Would really appreciate any direction. Thanks!

Best Answer

Welcome to StackExchange, Patrick!

It's really difficult to cut off all avenues for creating an opportunity. If someone were to use DataLoader, or Salesforce for Outlook, or etc, they could create an opp without hitting any of the roadblocks!

I'd go back to the business and question the assumption: Do they really need to prevent opportunities from being created without a contact? Would it be good enough (or better) to prevent opportunities from moving past a certain stage without a contact assigned? An argument in favor of the latter: If a sales rep wanted to open an opportunity but didn't have the best contact's info, the rep might create a bogus contact just to get things going. The current business requirement is encouraging that.

If you can go with preventing the opp from moving past a given stage without a contact role assigned, then you can use a before update trigger (or a visual flow) to enforce the rule. Here's one example:

https://salesforce.stackexchange.com/a/96129/4180

Related Topic