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
A GunaleA Gunale 

Trigger to update Contract object filed when related order object contracted checkbox is true

AnudeepAnudeep (Salesforce Developers) 
Here is a sample code
 
trigger updateContract on Contract (after insert, after update)
{ 
    List <Order> ordList = new List <Orders>();
    List <Id> cons = new List <Id>();

    
    for(Contract con : trigger.new)
    { 
            cons.add(con.Id);

        }
    //Write down your relationship query here

 ordList = [ Select id from Order where contracted=true and ID in:cons]

for(Order ord: ordList) {
   //update your orders here
}

}

NOTE: The code provided is an example. You'll need to review and make modifications for your organization.

If you find this information helpful, please mark this answer as Best. It may help others in the community. Thank You!