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
AniseenAniseen 

Need guidance on best approach

Need guidance. I am working on auto renewal functionality where when the end date is today and with few other conditions, the end date should be updated depending on the renewal term. I have created a Workflow rule that has time based actions to update record fields 2 hrs after agreement end date. Example if end date is today 2/9/2017 and it has auto renew checked and renewal term 2 years, then I want to have the record auto update the end date to 2/9/2019. Question,

1. Is WF is the best way to do this for a large data? We have over 50,000 records in the system which means all 50000 record will be in Time Based Workflow queue and execute only records that meet the criteria (thats is end date today). Is there any risk having so many records sitting in Time based workflow quueue? Will the system performance be impacted?
2. If WF is not the best way, what is the best way? I am new to coding so need some guidance.
Thanks.
DixitDixit
I would do an scheduled class, where i query those records which end_date__c =: system.today() AND auto_renew__c = True 

Still my class should run every day "forever" but it would be a way of avoiding WF and would only manage those records retrieved by the query, if the query is null <do nothing> and that's all.