I've been reading a lot about this on other people's threads, but haven't seen a real solution. It's easy to create a workflow rule (or process builder process) that triggers on object creation or editing, but is there really no way of creating a rule that triggers on a date set in a custom object field? In this situation, we have job placement objects that have a "job closed" date field. We need to change the status of each job placement object to "Closed" on the date set in the "job closed" field. Is there a way do this using Apex?
0
votes
1 Answers
0
votes
Workflow and Processes are both triggered only on DML operations (saves). Upon being triggered, though, a Time-Based action can be queued to run at a later date. When that date comes, if the record no longer meets the criteria in the initial workflow/process, the action will not occur.
So, you can create a Workflow rule that says, when a Job Placement is saved and the Job Closed field is not null, then 0 days after the Job Closed Date, update the Status to "Closed".
The effect is the same as you want, you just have to get used to how to configure it. Alternatively, you could write an Apex Batch class that runs daily and looks for records meeting the criteria, but why bother when the declarative solution works.