How can an app builder meet this requirement?
Show answerHide answer
Correct answer: D Create a validation rule that uses the PRIOR VALUE function.
Explanation
Explanation:The requirement is to allow users to decrease the Estimated Hours field but prevent them from increasing it. This requires a rule that can compare the new value being entered to the old value that was previously saved on the record.
Why D is Correct:
The PRIORVALUE function in a validation rule returns the previous value of a field before the current save operation began. A validation rule can be written to fire (and prevent the save) if the new value is greater than the old value.
Example Validation Rule Formula:
AND(ISCHANGED(Estimated_Hours__c), Estimated_Hours__c > PRIORVALUE(Estimated_Hours__c))
How it works:
This rule checks if the field was changed and if the new value is greater than the old value. If both conditions are true, the validation rule returns "True," triggers an error, and prevents the record from being saved. This successfully blocks increases while allowing decreases and the initial value setting.
Why A is Incorrect:
A formula field is read-only and is used to calculate a value. It cannot be used to enforce a business rule that restricts user input on another field. It cannot prevent a user from saving a value.
Why B is Incorrect:
The PREVGROUPVAL function is used in summary reports and analytics functions to compare the value of a previous grouping to the current one. It is not used in validation rules or for checking the prior value of a field on a single record. The correct function for this context is PRIORVALUE.
Why C is Incorrect:
The ISCHANGED function only detects if a field has been modified. It returns TRUE if the field is different from its original value. However, on its own, it cannot determine if the change was an increase or a decrease. You need to combine it with a function like PRIORVALUE to compare the old and new values to determine the direction of the change.
Reference:
Salesforce Help - "PRIORVALUE" and "Examples of Validation Rules". The PRIORVALUE function is specifically designed for this use case in validation rules, allowing you to compare old and new field values to enforce complex data integrity rules.