0

Validation Rule:

GP_Locked__c && ISCHANGED(Total_GP__c)

We are only editing the opportunity record, Ticking the GP_Locked__c Field (Boolean), for the purpose of locking the $GP amounts.

And the Error is firing.

Validation rule is erroring for what looks like Total_GP__c change. However we are not updating any other values.

So the Prior Value must not equal the New Value, even though no change.

The Total GP is ultimately derived from multiple Rollup Summary Fields.

I.E.

Total_GP__c is a Currency Formula Field:

Amount - Costs__c

Amount is the Standard Amount Field

Costs__c is a Formula of the addition of Cost Rollup fields

HardwareCosts + SoftwareCosts + ServiceCosts +... etc

6 rollup Summary Fields added up in total 1 rollup looks like this, but they are all very similar:

Data Type:  Roll-Up Summary
Summary Type:   SUM
Summarized Object:  Opportunity Product      
Field to Aggregate: Opportunity Product: SubTotal Buy
Filter Criteria:    Product TypeEQUALSHardware

All of these fields work perfectly. It is just the validation

0

I still do not understand why this situation is occurring all of a sudden. it has been working happily for almost a year. Not sure when it started failing. I think the answer is there is a new Salesforce Bug.

But what I have found is the Prior Value and the New Value which should be the same are not.

With this Validation rule it passes:

GP_Locked__c && ( ABS(PRIORVALUE(Total_GP__c) - Total_GP__c) > 0.009 )

But with this Validation Rule it fails:

GP_Locked__c && ( ABS(PRIORVALUE(Total_GP__c) - Total_GP__c) > 0.001 )

This means the error is between 0.001 - 0.009 dollars different.

Hence I am now using the top Validation rule.

I considered using 2 rounded fields(prior & current) to compare them but there was still a chance 1 rounded up and the other rounded down. This way above, enabled me to determine a ballpark place value of the amount they were out by. However not guaranteed it wont break again, if rounding errors get higher.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.