0

I want to create a Validation Rule that must fire when Account Name is changed and profile is different from ProfileId_1 and ProfileId_2.

I tried with different validation rules, but none works:

  1. ISCHANGED(Name) && ($Profile.Id != '00e24000000YVsFAAW' && $Profile.Id != '00e240000011Ib0AAE')

  2. ISCHANGED(Name) && ( contains($Profile.Name, 'System Administrator') && contains($Profile.Name, 'Profile2') )

  3. ISCHANGED(Name) && ($Profile.Name != 'Profile2' && $Profile.Name != 'System Administrator')

  4. ISCHANGED(Name) && ($User.ProfileId != '00e24000000YVsFAAW' && $User.ProfileId != '00e240000011Ib0AAE')

This part of the rule ISCHANGED(Name) works perfect, but when I try to check profiles it does not work. Ids and names have been checked in the database and are correct. Also, I tried to test them separately, first checking Name and then checking profiles. Profiles checking never works.

  • 1
    Never ever ever use hard-coded Ids. Even in a Validation Rule. – Adrian Larson Nov 6 at 14:15
4

Checking profile names/IDs have always been problematic in validation rules. You shouldn't do it. Instead, create a Custom Permission, assign it to the two profiles, then you can easily check for that:

ISCHANGED(Name) && NOT($Permission.Change_Account_Name)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.