+ Start a Discussion
btran3btran3 

Validation Rule for not allowing products to be added.

Hi,

 

I am looking to make a validation rule so that when an opportunity hits a specific stage that opportunity products can no longer be added.  I am unsure of how to tell the validation rule to lock a user out of adding products.  If you could assist with this rule it would be greatly appreciated.

 

goabhigogoabhigo

You may have to create a roll up summary field in Opportunity which counts number of Opportunity Line Items. Then create a validation rule which checks for change in this field when stage is a specific one. Something like below:

 

AND( ISPICKVAL(StageName, 'YourStageName'), ISCHANGED(RollupFieldName__c))

goabhigogoabhigo

OR

 

You can write a validation rule in Opportunity Line Item itself:

AND(ISNEW(), ISPICKVAL(Opportunity.StageName, 'YourStageName'))

 

Both the cases the user might have entered all the details and then when clicked on Save this error will be shown. You might have to override the page to check whether the stage is X, if not redirect to standard Add Product page.

ReidCReidC

I like the validation rule.  I suppose if you wanted to remove the "Add Product" button, you could do a workflow that updates opportunity record type once a certain stage is reached, and then associate a page layout with that record type where the add product button is removed from the products related list.