+ Start a Discussion
Prashant GulvePrashant Gulve 

Create a job which will run every hour and sync the opportunity and opp products with order and order products.

Create a job which will run every hour and sync the opportunity and opp products with order and order products.
(ex. if amount field on order changes from 100 to 200 then update related opportunities amount field with 200) same for order line items and opportunity line items
McCuboMcCubo
Hi Prashant,
I would suggest to do the sync between the objects using triggers instead of an scheduled job. that way you won't have to wait any time to see the updated data on opportunities and lines items.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi prashant,

You may use record triggered flows when a record is update then it updats the related parent records. Runnig a Job on that high data would be okay btu may not be best approach.

Thanks,
 
Prashant GulvePrashant Gulve
Hi McCubo and Sai thank you for your suggetions but i have to create Apex class on it can we create it through apex. and sync with objects.
McCuboMcCubo
Prashant,
Then I would suggest using a batch job (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm) (since the number of records could be quite high), querying for opportunities that have changes since the last job execution, and the sync the related order records. and a second job to do the same for opportnity line items and order line items.
you can also refer this document: schedule jobs in apex (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm)