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
Shubhangi JadhavShubhangi Jadhav 

How i can write trigger to get old value of order status

if order status is cancelled it should not be editable by user
RituSharmaRituSharma
You may get pld value of the status field using trigger.old. Sharing the code just for reference:

for(Order od: trigger.old) {
      system.debug(od.Status);
}
SwethaSwetha (Salesforce Developers) 
HI Shubhangi,
You might want to consider using a validation rule for your scenario like 

AND (
ISPICKVAL(Status,'Cancelled'),
OR(
ISCHANGED(Field1),
ISCHANGED(Field2),
etc,etc
),
!$Setup.HierarchyCustom_Setting__c.ProfileName
)
So if any of the Field1, Field2, etc, etc value is changed by a profile except the profile ProfileName(if you need this) it will display an error message.

Related: https://developer.salesforce.com/forums/?id=906F00000005JWuIAM

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you