Loading

Lock a Checkbox Field after It Has Been Selected and Saved

Udgivelsesdato: Jul 3, 2026
Beskrivelse

To prevent users from deselecting a checkbox field in Salesforce after it has been checked and saved, you can create a validation rule on the object.

This approach is useful for fields that represent one-way state transitions, such as marking a record as Approved, Completed, or Verified, where the value should not be changed back after confirmation.

Løsning

Create a Validation Rule

To create a validation rule:

In Lightning Experience

  1. Go to Setup.

  2. Open Object Manager.

  3. Select the required object.

  4. Click Validation Rules from the left navigation.

In Salesforce Classic

Standard Object:

  1. Go to Setup.

  2. Search for the object name in the Quick Find box.

  3. Click the Validation Rules link under the object name.

Custom Object:

  1. Go to Setup.

  2. Search for the object in the Quick Find box.

  3. Select the object.

  4. Scroll to the Validation Rules section.

Configure the Validation Rule

  1. Click New.

  2. Enter a descriptive rule name.

  3. Add the following formula in the Error Condition Formula field:

AND(
PRIORVALUE(checkbox__c),
TRUE,
ISCHANGED(checkbox__c)
)

Note: Replace checkbox__c with the API name of the checkbox field you want to lock.

This validation rule uses three Salesforce formula functions together:

  • PRIORVALUE() retrieves the value of the checkbox before the current save operation.

  • ISCHANGED() returns true when the field value has been modified.

  • AND() ensures all conditions are true at the same time.

The rule prevents users from unchecking a checkbox that was previously selected because the formula detects that the checkbox was already true and is being changed.

  1. Add an Error Message and optional description.

  2. Select Top of Page or a specific field for Error Location.

  3. Click Save.

 

Vidensartikelnummer

000385194

 
Indlæser
Salesforce Help | Article