Loading

Prevent Lead Owner change with a validation rule

Дата публикации: Oct 13, 2022
Описание
A validation rule can be created on the Lead object that prevents the Lead Owner field from being changed by users under certain profile.
Решение

Below are the steps for setting up this type of validation rule:
 

1. Obtain the Profile ID for the profile to restrict from making changes.
Example:
Profile -- Consulting User
Profile ID from the URL in Classic --  https://na9.salesforce.com/00eE0000000vGNQ
Profile ID form the URL in Lightning -- https://na9.lightning.force.com/lightning/setup/EnhancedProfiles/page?address=%2F00eE0000000vGNQ  

2. Go to the validation rule page.
In Classic: Setup | Customize | Leads | Validation Rules
In Lightning: gear icon | Setup | Object Manager | Lead | Validation Rules

3. Click New to create a new validation rule.

4. Input the following formula into the Error Condition Formula field according to your requirement, being sure to replace the 15-digit ProfileID with the correct ID:

* Prevent All Users from Changing Lead Owner.
ISCHANGED(OwnerId) 

* Prevent All Users from Changing Lead Owner of records they do not own.
AND(
ISCHANGED(OwnerId),
$User.Id <> PRIORVALUE(OwnerId)
)

* Prevent Users from specific Profile from Changing Lead Owner.
AND(ISCHANGED( OwnerId ), $User.ProfileId = '00eE0000000vGNQ')

* Prevent Users from specific Profile from Changing Lead Owner of records they do not own.
AND(
ISCHANGED(OwnerId),
$User.Id <> PRIORVALUE(OwnerId), $User.ProfileId = '00e6A000001NnZT')

5. Be sure to define both a Rule Name and Error Message (required) for the rule. Click Save.



To test the validation rule, have the User log in and try to save a change to the Lead Owner field.


Notes:

  • This type of validation rule can be created for any standard or custom object. In this example, we are simply using Leads.
  • This type of validation will ONLY work with single record transfer as validation rules DO NOT evaluate on the mass transfer of records. To prevent the mass transfer of ownership, a custom APEX solution would need to be leveraged. >


For more information on validation rules, please see Validation Rules.
 

Номер статьи базы знаний

000385858

 
Загрузка
Salesforce Help | Article