Skip to main content

How to prevent the changes to the field in Salesforce after it has been saved?



If the requirement is to prevent the changes to a field after it has been saved initially, there can many ways to do it but the best approach would be from the Validation rules. Its quite simple in Validation rule than doing the same in triggers with apex code.

Lets take an example, In the Orders Object you have custom field 'Initial_Payment_Made__c" and once this field has been saved, we should not be able to edit or prevent any changes to this field.

We can create a validation rule for this as below.

AND(
   ISCHANGED( Initial_Payment_Made__c ),
   NOT( ISNEW() )
)


Comments