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
RoscoeRoscoe 

Preventing users from adding same product to the opportunity?

Is there a way to prevent users from adding same product to the opportunity? We have a situation where users adding same product to the opportunity twice and want to avoid this.
 
Thank you in advance
London BenLondon Ben
I'm assuming you are asking is there any way to achieve this using the built in functionality?  in which case I would say - No....
 
However, that said - it's pretty easy to achieve the result you want with an APEX trigger...
 
This could fire whenever a user tries to add/update an opportunity line item (opp product) using the start below.
 
 
Code:
trigger myAccountTrigger on OpportunityLineItem (before insert, before update)

// ETC...

 
If you don't know how to write triggers with apex - take a look at this docco
 

If it all looks too much - drop me an email beningram@hotmail.com - I'm sure I can knock something up for you pretty quickly for a very modest little fee :)
CrmzepherCrmzepher

Hello Ben,

We have Professional version and therefore no Triggers. Any ideas on how I could code something that would check to see if the product has been sold or not?

We sell real estate there fore we have created a number of custom fields in the Opps tab that have the Development Name (unique primary field from a Product Custom Object tab), Unit type, Unit Floor, Unit Number, etc . . . my idea is to have a html file or xml file (excel spreadsheet) that has a current product inventory based on the development name that is called upon. Each product would have a status of Sold, Reserved, or available, Of course to avoid data input errors each property in the spreadsheet would have a specifc ID number.

Thinking it out it would be best that the broker had a hyperlink button that called up the property inventory in a popup for that particuliar development and then they could click on the right ID and load all the property information into the Opps page, Taking it from that angle the brokers could never sell the same product.

thanks,

crmzepher