0

I have a picklist field that needs to have the default enforced for only one profile, if Record Type is "Implementation Work Order". I have made the Project Phase picklist value "Configure - Scheduled RTC" the default field value for the profile. I now need to prevent the users from changing the Project Phase field to another picklist value.

The profile will need to select other values in the Project Phase field, when using other record types.

This is the Validation rule I have created, but it is hitting a syntax error:

AND( 
    $Profile.Name <> 'Project Management', 
    $RecordType.DeveloperName <> 'Implementation Work Order',
    IsPICKVAL(Project_Phase__c, 'Configure - Scheduled RTC')
)

Note: The syntax error is highlighting the comma after the Record Type line

7
  • 1
    Not an answer, but it is always best to consider creating custom permissions instead of hard-coding profile names. You then simply test to see if the user has the custom permission (or not) and behave accordingly. You can find examples all over the place, including this previous Q&A. You can add the custom permission to profiles or permission sets.
    – Phil W
    Mar 21 at 14:33
  • Hi Phil - Admittedly, I have used custom permissions for only a few use cases. I think to use them when I am adding permissions vs. this use case where I am restricting them. They've had access to the field and full picklist values for years, the recent requirement to restrict it and add a profile specific default value is new. I'll revisit, but if I've missed this as a use case, Im interested.
    – B Leahy
    Mar 21 at 15:04
  • A custom permission can be considered either positive or negative. It comes down to the way it is used in the validation rule.
    – Phil W
    Mar 21 at 15:35
  • there is nothing wrong with that syntax. Possibly there's a conflict with the rest of the validation rule? Or is this everything in it? Mar 21 at 15:37
  • 2
    DeveloperName is the API Name, which cannot have spaces. If you want to refer to the Label, then use Name field. Also, using the global var for RecordType is not recommended, see documentation. Mar 21 at 15:57

0

Your Answer

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

Browse other questions tagged or ask your own question.