+ Start a Discussion
Dale WorthingtonDale Worthington 

How to create a class and trigger that closes an opportunity from a Contract Approval flow

Hi All

Im hoping someone can either start me off or point me in the right direction for closing a related opportunity when a contract is activated.
Contracts are activated though an approval flow and unfortunately because of this i cannot build a process in the process builder to close opportunities - it must be done though a trigger.

I understand I need 2 things. 1. The Class which defines what changes need to happen, and 2. The trigger which goes on the contract record to start the class.
 
Where is a good starting point for this?
 
 
 
Nevlyn DSousa TicloNevlyn DSousa Ticlo
Hi Dale,

You will need an After Update trigger on the contract object, that will call your TriggerHandler class in which you will write the logic to query for all related opportunities that are tied to the Contracts and set their close dates/change their statuses to closed accordingly..

let me know if you still need any more help with this. 
Dale WorthingtonDale Worthington
Hrmm i think this might be a little over my head.