0

Trying to prevent users from being able to create the record if the field Configuration_Request_Type__c is "Feature" or "Enhancement", but also not edit the same field once record is created by another. Only a list of users can create or edit the field with the values of "Feature" or "Enhancements".

Configuration_Request_Type__c has 3 values:

  • Feature
  • Enhancements
  • Fix

This VR won't allow them to create with those values, BUT how can I stop them from editing the same field?

AND(
    (ISNEW()),
    OR(
        ISPICKVAL(Configuration_Request_Type__c,'Feature'),
        ISPICKVAL(Configuration_Request_Type__c,'Enhancement')
    ),
    OR(
        $User.Id !="005d0000002mKHp", 
        $User.Id !="005d0000000Twif",
        $User.Id !="005d0000000TvOu", 
        $User.Id !="0050V000007Mlad", 
        $User.Id !="005d0000000TuyJ", 
        $User.Id !="005d0000000TvrH", 
        $User.Id !="005d0000001VFkj", 
        $User.Id !="005d0000001Wyup", 
        $User.Id !="0050V0000075L2C", 
        $User.Id !="005d0000002mIBQ", 
        $User.Id !="005d0000005n0pm", 
        $User.Id !="0050V000006kNzs", 
        $User.Id !="0050V000006kNt7", 
        $User.Id != "005d0000005I9dx", 
        $User.Id != "005d00000040uDS", 
        $User.Id != "0053o000008r0a8", 
        $User.Id != "0053o000009lIz3", 
        $User.Id != "0053o00000AaU4u" 
    )
)
1
  • 3
    Quick tips for validation rules in general: 1 - When you're checking a single field against multiple values, you need to use AND() when comparing inequality (and OR() when comparing equality). 2 - Hard-coding Ids is generally a bad idea. This would be better as a custom permission.
    – Derek F
    Commented May 15, 2023 at 18:35

1 Answer 1

0

how can I stop them from editing the same field?

By creating another validation rule.

Validation rules can only emit a single error message, so some good rules of thumb to determine if you need a separate validation rule are:

  • Do you need to emit a different error message in your additional scenario?
  • Should the error appear on a different field (or on a specific field instead of on the overall record)?

Answering "yes" to either means you should probably have a separate validation rule.

Beyond that, the thing you're looking for is the ISCHANGED() function (e.g. ISCHANGED(Configuration_Request_Type__c)). A plain language version of the validation formula might be

Prevent the record from saving when: Request Type has changed, and the current user doesn't have the permission set that allows them to change the request type.

You must log in to answer this question.

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