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
SuzanyuSuzanyu 

Trigger on field

I want to create a new trigger on a specified field(standard, custom).
 
When "status" field in Opportunity is changed or updated the trigger will be fired to modify some information in the correspongding account.
 
How can I deal with it? More tricky for me.
If trigger events can not be applied on the field objects, any other solutions will be appreciated. Thanks 
Best Answer chosen by Admin (Salesforce Developers) 
saasdevsaasdev
You don't create triggers for fields, but rather the object the field contains, so you would need to create a trigger that fires everytime any opportunity is updated, then based on your business logic, write some code that determines whether any other changes should take place (i.e. if (opportunity.status == 'Open')), then some code for the resulting action. If you want to compare old and new values for the field you can use trigger.old  to access the old value and trigger.new to access what the field is being updated to.