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
Mikeb66Mikeb66 

Validation Rule (Opportunities)

I'm attempting to create a Validation Rule for an Opportunity based on an Opportunity Split. Basically, we can have up to 3 reps own an Opportunity and each gets a % of the Amount. I want to create a rule that will validate that the 3 % fields = 100% and that the Calculated Value for each portion of the Split = the Amount.

 

Here are the Formulas that I created:

 

 X2nd_Rep__c + X3rd_Rep__c + Primary_Rep__c ==100

 

This throws no errors when I check the Syntax, but the rule doesn't seem to do what I want it to. I can enter in 100% for each Sales Rep % field and no error is thrown, I can also enter in values that total to less than 100 and still no error is thrown.

 

The other formula I have is to verify that the Sum of the Rep Splits = the Amount. Here is the formula:

 

Primary_Rep_Bookings_Amount__c  +  X2nd_Rep_s_Booking_Amount__c  +  X3rd_Rep_s_Booking_Amount__c  == Amount

 

Please let me know what I'm doing wrong or if there is a better way to do this.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
jhenningjhenning

A validation rule throws an exception when the error MATCHES the rule. In your sample:

 

 X2nd_Rep__c + X3rd_Rep__c + Primary_Rep__c ==100

 

It will throw an error when the percent adds up to 100. You want a rule as follows:

 

 X2nd_Rep__c + X3rd_Rep__c + Primary_Rep__c <>100

 

 

All Answers

jhenningjhenning

A validation rule throws an exception when the error MATCHES the rule. In your sample:

 

 X2nd_Rep__c + X3rd_Rep__c + Primary_Rep__c ==100

 

It will throw an error when the percent adds up to 100. You want a rule as follows:

 

 X2nd_Rep__c + X3rd_Rep__c + Primary_Rep__c <>100

 

 

This was selected as the best answer
Mikeb66Mikeb66
Thanks John, that worked perfectly!