+ Start a Discussion

Validation Rule against the opportunity for opportunity products

Hi there. I was hoping someone could help with this issue. I contacted salesforce support and while they do not support validation rules they did say it can be done (though I have no idea how)


I am trying to create an opportunity validation rule on an opportunity so sales people cannot have certain opportunity products on a closed won deal.


The reason I am doing this is because we have a number of different line items falling under one product category. Often times early in a deal the sales people do not know specifically which line item it is, so there is a generic one. I dont want an opportunity to be closed won with one of those generic products as the sales person should know by then which specific product it is. 


Unfortunately when creating a validation rule I dont have access to opportunity products only pricebooks. I could create a generic pricebook with those generic products in it but I dont know to do that because if a sales person has one generic and one specific, you could add them (because they would be on different pricebooks)


So can anyone think of a validation rule that would work or a way around this problem?


Thanks in advance for your help!

Best Answer chosen by Admin (Salesforce Developers) 

Try this.


Step 1

Create a rollup summary field that counts the opportunity product lines on the opportunity and set it to only count the ones that are generic.


Step 2

Create validation rule on the opportunity that says if the field created in step 1 >0 and stage is Closed Won/Closed Lost then trigger the error.


Let me know if you need anything else.


To your Success!


Kevin Edelmann