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
Max WellMax Well 

Validation rule to make sure that one custom field amount always be less or equal to the another custom field amount

Hey folks,

I need help to craete the validation rule that the custom field amount is always equal or less than the another roll up summary field amount.

I have below validation rule which is not working:

OR ( 
Total_Amount = Roll up summary field amount, 
 Total_Amount < Roll up summary field amount)
@Max Well - You are referring to the field API names inappropriately in your validation rule. A simple way to identify a custom field on a Salesforce object is it always ends with an "__c". You can leverage the advanced formula editor provided by Salesforce while writing validation rules to ensure the appropriate field is being inserted within your validation rule. T

The snapshot for the Advanced Formula Editor popup provided in the validation rule screen, using the same is as below.

Advanced Formula Editor Popup for Validation Rule
Assuming that the custom amount field is Total_Amount__c and the custom rolled up amount field is Rollup_Amount__c, the validation rule would be as follows.
Total_Amount__c <= Rollup_Amount__c

One of the points that you need to consider while building this validation rule is the order of execution. Since the Validation Rules execute before Rollup Summary fields, you may not get the right output. Refer the following link to understand the order of execution better - 

Please do not forget to mark the question as SOLVED and the answer as the BEST ANSWER if this helps you resolve your issue.