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

Trying to stop editing of field in Contact after save?



I'm quite new to the Validation Rule scene and am trying to stop editing of a field in the Contact object after save (namely the Customer field).


Does anyone have some sample code I could use in my validation rule?







Try the following in the Validation Rules:




The above restricts the Type value to be changed during record edit.






Thanks for the response. The field I want to stop from editing is a lookup field (Customer Name). When I am using the validation you have outlined above it can't find that field as it is a lookup. Any suggestions?




The same works for Lookup field also. IsCHANGED works for Look also. I have tried.



Rakesh KumarRakesh Kumar

If you want to make a page uneditable after save the record then you can just configure the page layout and remove edit button from page layout. After removing edit button from page layout then you have to also disable the inline edit function to "User interface setting".


i hope this may help to get your answer.


I would assume OP still wants to enable users editting all other fields.


In terms of the validation rule suggested above, it will give an error message once the user has done the edit, and prevent save. But then the user needs to cancel the update (losing all other legit updated values) or re-enter the original value for the field that may not be updated, which is not always easy to do, or would cost some time (find the record in another tab).


Would it not be a better approach to just discard of a possible field update in a before update trigger ? This though again would not notify the user in the default page implementation.