[SalesForce] Process Builder / workflow rules not firing

I'm having some issues with a Process builder. I want it to fire when the Last Modified Date is some time ago (a couple of minutes in my example below, just for testing) and that the Case Owner is also the last user who modified the Case (ownerId = Last modified by Id).

I've created my criteria node with this formula:

[Case].LastModifiedById = [Case].OwnerId ,
((NOW() - [Case].LastModifiedDate )*24 ) > 0.05

And well, it just doesn't fire.

For testing, I've created a formula checkbox field with the same criteria, and after 3min, it does work and the checkbox gets checked. Here's the formula for the checkbox field:

LastModifiedById = OwnerId , 
((NOW() - LastModifiedDate )*24 ) > 0.05 

Any idea of why the Process Builder is not firing?


Best Answer

Process builders, Workflows and Triggers are fired only when there is a change made to the record i.e. only when a DML operation is performed on the record.

Your checkbox formula does not have any issues and it correctly checks the checkbox after 3 minutes (when you refresh the page), in the same way your criteria node formula also doesn't have any logical issues, only problem is that your criteria will never meet when process builder is invoked. And that is because, as mentioned, process builder is invoked when record is created/edited, and when it is created/edited, ((NOW() - [Case].LastModifiedDate )*24 ) > 0.05 will never be evaluated to true as the difference would be in milliseconds. And it wouldn't be called again unless an edit is made to the record. So, whenever an edit is made, it will check the criteria which will always return false.

For your requirement, you will have to go with Scheduled Actions in process builder, wherein you can specify the criteria as [Case].LastModifiedById = [Case].OwnerId and then run your action after X hours/days from Now.

You can get more information on how to set the scheduled actions in process builder at this trailhead link.

Note that currently process builder only allows to set scheduled actions in Hours and Days.