function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mike A SmithMike A Smith 

How do I restrict a picklist option after the record is created?

Hi,

I have a formula working to restrict 2 picklist options (Feature , Enhancement) to most users but does allow them to select a Third option (Fix) when creating a NEW record. Can I add something to the same VR to then prevent the users from editing the record and selcting either 'Feature' or Enhancement'? Below is the piece of the VR that would prevent Dale Doback from selecting 'Feature' or 'Enhancement' when creating the record but Dale CAN save the new record with 'Fix' selected. But Dale is then able to edit the PL on the NEW record he created and change 'Fix' to either 'Feature' or 'Enhancement'.(but should not be able to do that) what can I add to the VR to prevent him from doing that edit and selecting either of those 2 PL options ? (In other words Dale is only ever able to set 'FIX' in the configuration request type...he should never be able to select 'Feature' or 'enhancement')

AND(
ISNEW(),
OR(ISPICKVAL(Configuration_Request_Type__c,'Feature'), ISPICKVAL(Configuration_Request_Type__c,'Enhancement')),
OR($User.Id !="005d000000xxxxxx", /*John Doe*/


Thanks.
VinayVinay (Salesforce Developers) 
Hi Mike,

You can try below validation rule.
AND(
ISNEW(),
OR(ISPICKVAL(Configuration_Request_Type__c,'Feature'), ISPICKVAL(Configuration_Request_Type__c,'Enhancement')),OR(ISPICKVAL(PRIORVALUE(Configuration_Request_Type__c),'Feature'),
ISPICKVAL(PRIORVALUE(Configuration_Request_Type__c),'Enhancement')),
OR($User.Id !="005d000000xxxxxx", /*John Doe*/))

Please mark as Best Answer if above information was helpful.

Thanks,
Mike A SmithMike A Smith
Thanks Vinay. I get the syntax error "missing ')' " at  OR($User.Id !="005d000000xxxxxx", /*John Doe*/
VinayVinay (Salesforce Developers) 
Hi Mike,

Sorry, I thought you haven't posted full validation rule,  Have updated now can you check.

Thanks,
Mike A SmithMike A Smith
Thanks. I tested as a user who should only ever be able to select/save 'Fix' and that worked when creating the NEW record (it gave the error message on attempts to save with 'Feature' and 'Enhancement' but allowed the save with 'Fix') but then after the record was created/established I then tried to edit the 'Confirguration Request Type' field (showing 'Fix') as that same user and was successful in selecting and saving 'Feature' (it gave no error, it allowed the save so the record now shows 'Feature' in 'Configuration Request Type')
VinayVinay (Salesforce Developers) 
AND(
ISNEW(),
OR(ISPICKVAL(Configuration_Request_Type__c,'Feature'), ISPICKVAL(Configuration_Request_Type__c,'Enhancement')),OR(ISPICKVAL(PRIORVALUE(Configuration_Request_Type__c),'Feature'),
ISPICKVAL(PRIORVALUE(Configuration_Request_Type__c),'Enhancement')), ISCHANGED(Configuration_Request_Type__c),
OR($User.Id !="005d000000xxxxxx", /*John Doe*/))

Can you check above?

Thanks,
Mike A SmithMike A Smith
Thanks Vinay. With that update it now allows retsricted users to select and save  'Feature' or 'enhancement' when creating a new record. In other words I logged in as a restricted user and started filling out a new record and it did not give me any errors when I selected 'Feature' or 'enhancement'. Likewise if I create a new record with 'Fix' selected and then edit that new record and change the Configuration Request Type to 'Feature' it still allows that save/update like it did before.(no error message)
Gavin BrodyGavin Brody

Here's an updated version of the validation rule:


AND( ISCHANGED(Configuration_Request_Type__c), NOT(ISNEW()), OR( ISPICKVAL(Configuration_Request_Type__c, 'Feature'), ISPICKVAL(Configuration_Request_Type__c, 'Enhancement') ), $User.Id = "Dale's User ID" )

Replace "Dale's User ID" with the actual User ID of Dale Doback. This condition ensures that if the Configuration Request Type field is changed and the new value is either 'Feature' or 'Enhancement', it will only trigger the validation rule if the user editing the record is Dale Doback. This will prevent Dale from selecting those options once the record has been created with 'Fix' selected. If you need more updates this https://dailysportsupdates.com/ platform is very updated and informative must explore it.