0

We have a custom object which has a record type 'Ratio'. When the record type is 'Ratio', we need the user to input numerator and denominator and value.

We would like to avoid auto-setting the value through a process builder because that makes override complex, instead we prefer a validation rule that we can turn off through custom settings.

The validation rule looks like so

ROUND(Value__c,2) != ROUND(ROUND(Numerator__c,2) / ROUND(Denominator__c,2),2)

but sometimes this fails. In general what we are really looking to do here is to say that the distance between the provided ratio and the computed one is less than a certain threshold.

Are there best practices to express this sort of validatin rules?

1 Answer 1

2

You can use a comparison operator, such as:

ABS(Value__c - (Numerator__c / Denominator__c)) > 0.01

This says that the difference of Value__c - (Numerator__c / Denominator__c) must be less than 0.01. You can adjust this to meet your threshold requirements.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .