We're planning to use Salesforce Contract(or a custom object) to track signed(active) contracts with the customer. Business wants to see on account level if a customer has active contracts.
Designing the solution, I'm planning to implement a trigger that gets all the contracts checks if there's an active contract and sets checkbox hasContract on Account. The only edge case that a trigger can't handle is when no Account updates and no Contract updates happened
Example: Contract Start Date is 1/1/2018, End Date is 1/1/2019. Account.hasContract equals to true. Nor account or contract had any updates since 1/1/2018 until 1/1/2020. For the period from 1/1/2019 to 1/1/2020 the Business would see that the account has Contract, while in reality the contract ended 1/1/2019.
The only solution I could think about is to make a scheduled batch job that updates Account.hasContract field.
Question - is there any other way to handle the edge case? Maybe salesforce provides a standard solution that I just cannot find?