[SalesForce] Account Validation Rule That Exempts Specific Profile IDs

I'm hoping to create a validation rule so that Once a Ship To ID (custom field on account) exists that starts with "6" or "7" users cannot change the Account Name with the exception of if you are a users with a system admin or a datamigration profile (profile IDs listed below).

I have created this but it is not working–

AND (
    LEFT (Ship_To_ID__c, 1) = "6" || LEFT (Ship_To_ID__c, 1) ="7",
    ISCHANGED ( Name ), 
    $Profile.Id <> "00eC00000012E4i"|| $Profile.Id <> "00e800000017STg"
 )

Can someone help me?

Best Answer

You're using an OR to check the profile, which means that if it is one, it won't be the other (it will always be true). What you meant to do was to use AND, meaning it must not be one AND not be the other. You can also make the first part more efficient by using CONTAINS.

AND(
    CONTAINS("67", LEFT(Ship_To_ID__c,1),
    ISCHANGED(Name),
    AND($Profile.Id <> "00eC00000012E4i",$Profile.Id <> "00e800000017STg")
)
Related Topic