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
NevDevNevDev 

How to prevent a user from adding a product to an Opportunity if that Product is related to a Closed Won Opportunity

I would like to prevent a user from adding a Product to an Opportunity if that Product has already been related to a Closed Won Opportunity. 

Here is the user story:

An Estate Agent has created an Opportunity for a deal that he/she is working on. He/She adds the the Propert (Product) to the Opportunity. He/She closes the deal as Closed Won.

Another Estate Agent creates a new Opportunity and tries to add the same Property to their Opportunity record. They receive an error message notifying them that this property is no longer available. 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi,
To stop a user from adding products to an opportunity. Hope it helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
NevDevNevDev
Hi Rahul,

Thanks for the links but they do not apply to what it is I am looking for. 
I want the validation to only kick in if a product has already been assigned to another opportunity which is closed won. 
I need some way of controlling the Product Active checkbox to make it Inactive if that Product is associated to an Opportunity that is Closed Won.