Loading

Conditionally make a field required

Date de publication: Aug 6, 2024
Description
It's possible to conditionally make a field required by using a validation rule.
Résolution

The following Validation Formula can be used as a reference.

AND(Account_Market = "Corporate", Test = "")

This will give an error message if "Test" has no value when Account Market is "Corporate". 
 

Create validation rule in Salesforce Classic

 

1. Click Setup.
2. Click Customize | [the object you need to modify] | Validation Rules
3. Click New.
4. Enter the Validation Rule name.
5. Set the Validation Formula as per the suggestion above, feel free to adapt to your needs.
6. Set the error message that the User will receive. 
7. Click Save.

 

Create validation rule in Lightning Experience

 

1.Click the gear icon then Setup
2. Click Object Manager | [the object you need to modify] | Validation Rules
3. Click New.
4. Enter the Validation Rule name.
5. Set the Validation Formula as per the suggestion above, feel free to adapt to your needs.
6. Set the error message that the User will receive. 
7. Click Save.

Ressources supplémentaires

For assistance with your specific formula, visit the Salesforce Trailblazer Developer Community.

Validation Rules
Examples of Validation Rules

Trailhead - 
Create Validation Rules

Numéro d’article de la base de connaissances

000385092

 
Chargement
Salesforce Help | Article