function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tedevangtedevang 

Prevent Duplicate Opportunity Name

I would like to set a rule that doesn't allow duplicate Opportunity Names. Can this be done with workflow/validation or do I need to set a trigger for this?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
tedevangtedevang

Actually I ended up doing it using workflow. I set up a custom field called "Opportunity_Name_Dupecheck__c" and upon saving the opportunity, copied the Opportunity Name to the custom field. The custom field was set up to require a unique value so that it now throws an error when someone tries creating the same Opportunity Name. One side benefit of this is that the error has a link to the Opportunity so you can go right to it. The only extra thing I needed to do was bulk update any open Opportunities to populate the value of this field - which only takes a couple minutes.

 

Thanks.

 

-Ted

All Answers

Imran MohammedImran Mohammed

Trigger will be the right solution for this.

Imran MohammedImran Mohammed

Were you able to achieve it with a trigger or did you find any other way of doing that?

tedevangtedevang

Actually I ended up doing it using workflow. I set up a custom field called "Opportunity_Name_Dupecheck__c" and upon saving the opportunity, copied the Opportunity Name to the custom field. The custom field was set up to require a unique value so that it now throws an error when someone tries creating the same Opportunity Name. One side benefit of this is that the error has a link to the Opportunity so you can go right to it. The only extra thing I needed to do was bulk update any open Opportunities to populate the value of this field - which only takes a couple minutes.

 

Thanks.

 

-Ted

This was selected as the best answer