Custom Field Validation Rule for "Hours Worked" | Salesforce Exam ADX-201

Create a Validation Rule for "Hours Worked" Field to Prevent Negative Values

Prev Question Next Question

Question

A company has a custom field "Hours Worked" and the sys admin is tasked to create a validation rule so that field will not accept a negative value.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E. F.

D.

The correct answer for this question is B. NOT(Hours_Worked < 0).

A validation rule is a rule that checks the data entered by a user in a record, and it returns an error message if the data entered does not meet specific criteria. The purpose of this validation rule is to ensure that the custom field "Hours Worked" does not accept negative values. Therefore, the validation rule needs to check if the value entered in the "Hours Worked" field is less than zero (negative).

Let's review each of the answer options and see if they meet this requirement:

A. Hours_Worked != 0 This option is checking if the value of "Hours Worked" is not equal to zero. However, this is not a valid validation rule to ensure that the field does not accept negative values.

B. NOT(Hours_Worked < 0) This option is checking if the value of "Hours Worked" is not less than zero (i.e., not negative). This is the correct answer option, as it meets the requirement of ensuring that the field does not accept negative values.

C. Hours_Worked__C <> 0 This option is similar to option A, as it checks if the value of "Hours Worked" is not equal to zero. Therefore, this option is not a valid validation rule to ensure that the field does not accept negative values.

D. Hours_Worked < 0 This option is checking if the value of "Hours Worked" is less than zero. This is the opposite of what we want to ensure with this validation rule, so this option is not correct.

E. NOT(Hours_Worked__C > 0) This option is similar to option B, as it checks if the value of "Hours Worked" is not greater than zero. However, the field name used in this option is incorrect (it should be "Hours_Worked" instead of "Hours_Worked__C").

F. Hours_Worked__C < 0 This option is similar to option D, as it checks if the value of "Hours Worked" is less than zero. Therefore, this option is not correct.

In summary, the correct answer is B. NOT(Hours_Worked < 0), as it ensures that the custom field "Hours Worked" does not accept negative values.