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
Valerie GValerie G 

Validation Rules NOT Working

I set up 1 Roll-Up Summary and 2 Validation Rules based on information I found in the Help & Training section as follows:

 

 

To prevent create & edit to Opportunity Line Items on Closed Opportunities

 

Create a Validation Rule on Opportunity Product

 

1.  Description: Prevents users from editing opportunity products after an opportunity is closed. Create the following validation rule example on opportunity products.

2.  Formula: OR(ISPICKVAL(Opportunity.StageName, "Closed Won"), ISPICKVAL(Opportunity.StageName, "Closed Lost")) Error Message: Opportunity Line Items cannot be created or edited because the Opportunity is closed.

3.  Error Message:  Opportunity Line Items cannot be created or edited ecause teh Opportunity is closed.

4.  Error Location: Top of Page

 

AND

 

To prevent deletes to Opportunity Line Items on Closed Opportunities

 

Create a Validation Rule on Opportunity

 

Assumes that you have a custom Roll-Up Summary Field on Opportunity object called Number of Line Items, that Counts the number of Opportunity Product records associated to an Opportunity.

  

1.  Description: Prevents users from deleting opportunity products after an opportunity is closed. Create the following validation rule example on opportunities. It uses a custom roll-up summary field on opportunities that counts the number of   opportunity products on an opportunity

2.  Formula: AND(OR(ISPICKVAL(StageName, "Closed Won"),

ISPICKVAL(StageName, "Closed Lost")),

Number_of_Line_Items__c <

PRIORVALUE(Number_of_Line_Items__c) )

3.  Error Message: Opportunity Line Items cannot be deleted because the Opportunity is closed.

4.  Error Location: Top of Page

 

I have comfirmed that both of these Validation Rules are marked as "active", but these rules are NOT preventing anyone from changing or deleting Opportuntity Products. 

 

Any ideas why the Validation Rules are NOT working?

 

Are there permissions that must be change at the profile and/or role level to allow Validation Roles to work? 

netTrekker_ADnetTrekker_AD

Is Number_of_Line_Items__c a custom field on the Opp or Opp Product?

 

We had similar issues I believe, in that validation rules on the Opp, that included Opp Product fields in the formula, were not triggering because of the parent-child relationship. I ended up having to create a roll-up summary field on the Opp that counted the custom Opp Product field and then wrote the VR using that field instead of the custom Opp Product field.

 

Here is a working Opportunity Product VR we currently use to prevent editing Opp Products after its "closed":

 

 

AND(OR(ISCHANGED(Quantity), ISCHANGED(UnitPrice)), ISPICKVAL(Opportunity.StageName , "Reviewed and Processed"))