1

I have a business scenario where I would like to restrict the transition to the Accepted status of the Quote object, only to the admin.

For this I configured a validation rule with the following error condition formula:

AND( 
   NOT($Profile.Name == 'System Administrator'), 
   ISCHANGED(Status), 
   TEXT(Status) = "Accepted" 
)

The problem is that this rule is preventing all types of users(admin and non-admin ones) from transitioning to the Accepted status.

In a bunch of other threads I have checked that this is actually considered an accurate approach.

Notes

I know that out there exist other approaches that are considered more efficient and consistent, like i.e. using a permission set, and referring to it, and not hardcoding the profile name in the rule, or even using custom settings.

In this case I am interested why Salesforce can detect this simple token through the $Profile.Name field.

9
  • Seems a duplicate to this question: Excluding System admin from this validation rule Oct 19, 2018 at 10:42
  • Well, I think it's not really a duplicate as even if I replace the aforementioned rule in: IF ( $Profile.Name = "System Administrator" , FALSE, AND( ISCHANGED(Status), TEXT(Status) = "Accepted" ) ) I am still unable to set the status to "Accepted". You can try it out in case. Oct 19, 2018 at 10:50
  • Have you checked which one is failing? NOT($Profile.Name == 'System Administrator') or TEXT(Status) = "Accepted"? Oct 19, 2018 at 10:58
  • 1
    Try $Profile.Name != 'System Administrator' Oct 19, 2018 at 11:13
  • 1
    Thanks @PragatiJain for the hint. After debugging the validation rule, I saw that the value read for the profile was Systemadministrator. Very weird because when I query all the profiles in an anonymous context, I see that the name of the admin profile is System Administrator indeed. Is there any hidden field like a DeveloperName field or something that holds this info? Oct 19, 2018 at 13:29

1 Answer 1

1

It may be due to translation because profile name translated to a language used on Org. We already have a post regarding that ($profile.name in validation rule not working). You can choose one of the suggested solutions from this post.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .