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
Sara SharonSara Sharon 

How to update Account end date based on latest contract end date

I have a Billing end date field in Account. I would like this to be updated when I create or update a contract for this account. How to achieve this ?
1. If I wanted to do it going forward only ?
2. If I also want to handle past data.
SidhantSidhant

Hello, Sara-

1. I believe you can use a Process Builder on Contract object to update/populate the Date field on Parent Account.
2. Assuming it is a one-time thing, I think you need to write an Apex script which could be run on Anonymous window to handle the historical data.
You may need to keep in mind of the governor limits, check if there are any other processes(Workflow, Process Builder, Triggers, etc.) which could affect the process while updating old data. Also, I think we need to consider which Date needs to go into Account if there are multiple contracts on the Account.


Let me know if you need further help with any of above case.
Best,

Sid