[SalesForce] Process Builder scheduled action changed – Time for Actions to Execute

I have a process builder in a custom object called Grant_Report__c.

Over there, if an email field is filled, I have a scheduled action to send an email 30 days before the Due_date__c field (it is a date field):

enter image description here

I did that process builder a year ago, and I have more than 1000 flow interviews that are waiting to send this email 30 days before that field.

Now I want to change the scheduled action Time for Actions to Execute from 30 days to 14 days. I understand that the interviews won't re-evaluate themselves automatically – Idea

QUESTION

I want to change my days of Time for Actions to Execute from 30 to 14 and then update all my interview records to re-evaluate their criteria or to delete them and re-create them, so all interviews would count agains 14 days before the date.

Is there a quick way to do that – maybe with an SOQL query or other way?

Best Answer

Rather than searching and deleting interview records, you can run a SOQL query where due date is on future date where those interviews have been queued.

Run a DML update operation on the Grant_Report__c records and because of this update it will re-evaluate the process and previous interviews will be out of the queues and new interviews will be queued.

You can quickly test at your sandbox before moving it to production.

How do I make sure these would be on the new criteria?

Since you are making changes to the process so it will create new version and after updating all the records, new pending and waiting interviews will get created.

You can monitor those upon reaching Setup->Flows and then Paused and Waiting Interviews.

Here is an example taken from my DE

Flow Monitoring

For more information, refer Monitor Your Processes’ Pending Scheduled Actions

If you still need to delete all pending interviews then write a SOQL query to retrieve records based on InterviewLabel with other suitable criteria and delete those.

FlowInterview fiObj = [SELECT CurrentElement,Guid,Id,InterviewLabel,IsDeleted,Name 
                       FROM FlowInterview
                       WHERE InterviewLabel = 'Sent_Email_after_case_creation-1_InterviewLabel' LIMIT 1];
delete fiObj;
Related Topic