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
Anshuman ParhiAnshuman Parhi 

Write a trigger on contact to show an error if status changes from new to closed and record should get saved if status changes from New to Open or Open to closed. (Note Take three status value (New,Open,Closed)).

Any solution for this......
Best Answer chosen by Anshuman Parhi
CharuDuttCharuDutt
Hii Ayushman
Try Below Trigger
trigger test on Contact (before update) {
    For (Contact con :Trigger.new){
        if(Trigger.oldMap.get(con.Id).Status__c == 'New' && con.Status__c == 'Closed'){
            con.adderror('heyyyy');
        }
    }
}
Please Mark It As Best Answer If It Helps
Thank You!