I created a validation rule to test the insert field. The Profile Id and Name is correct. Supposedly, only system admin can edit the record. However, even if I am logged in as a System Administrator, I am still getting an error message. Why is that?

This code is not working even if the Id is correct..

 $Profile.Id <> 'insert system admin id'

But this code works...

 $Profile.Name <> 'System Administrator'
  • Apart from the question why this is not working, it is certainly not best practice to hardcode an Id in a validation rule. Oct 21, 2022 at 7:49

1 Answer 1


Every ID is 15 digits and 18 digits. In this case you need to use 15 digits ID. Simply remove the last three digits from the ID you're getting from URL. (It worked for me)

As a best practice you should not hardcode the IDs

  • Or surround the left hand operator with CASESAFEID
    – cropredy
    Oct 23, 2022 at 18:49
  • It works! Thank you.
    – TheRipper
    Nov 13, 2022 at 9:07

You must log in to answer this question.

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