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
Karina ReynaKarina Reyna 

prevent picklist changes after selecting specific value in picklist

Hi everyone,

Essentially, I have a custom object called Repair and I'm trying to have it so a user can create a new Repair record with Status either "Not Started", "In Progress", or "Completed" and save it, but the catch is that Status is a picklist value and when a user selects completed from the Picklist and saves, the field should either become Read-Only after saving or cannot be changed after saving.

I currently have: 
AND (
ISPICKVAL(Status__c, "Completed"),
OR (
ISNEW(),
ISCHANGED ( Status__c )
))

as the Validation Rule to prevent it from being changed after saving, and it lets me save as "Not Started" and "In Progress" but not when it is set to "Completed".

I'm lost and I've been going at it for awhile - any help is appreciated. I've looked at other posts that have come close to getting to what I need but I haven't been able to get around the issue of not letting me save AS "Completed". It's technically doing the opposite of what I want it to do.
SwethaSwetha (Salesforce Developers) 
HI Karina,
Try
IF(ISPICKVAL(PRIORVALUE(status__c),"Completed") , true, false)
This will not let you make any changes to the status field after picklist value is marked as Completed.

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
GulshanRajGulshanRaj
Hi Karina,
You can use PRIORVALUE to check the previous value is "Completed" or not. Just like in the example given below I have added validation to not update the case if user try to change the status from "Working" to "New" status.
 
AND(
ISPICKVAL(PRIORVALUE(Status),'Working'),
ISPICKVAL(Status, 'New')
)


Thanks
Gulshan Raj (https://forceblazer.com/)
Coffman TimothyCoffman Timothy
Thank you for sharing your valuable solution, it's work properly.
https://www.marykayintouch.website/