Entitlement / Milestone field update doesn't trigger Process Builders - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Jonathan MillsJonathan Mills 

Entitlement / Milestone field update doesn't trigger Process Builders

We have setup an Entitlement Process in our org which upon hitting milestones performs a number of field updates on the Case record. These checkboxes correctly update when the milestone is hit, however Process Builders that are supposed to run off these checkboxes do not fire. We have confirmed that the Process Builder fires when the checkboxes are manually checked. We also tried creating a trigger that fires off the checkbox and checks another, however firing a Process Builder off this secondary checkbox also fails to run the Process Builder.

We have ensured that 're-evaluate workflow rules' is enabled on both the field update actions and tried setting the Process Builder to allow for recursion, neither of these settings resolve the issue.

We suspect this may be an order of operations issue? we need a work around.
Best Answer chosen by Jonathan Mills
Maria HuemmerMaria Huemmer
It looks like this is a known issue. https://success.salesforce.com/issues_view?id=a1p30000000SU70AAG

All Answers

Amnon KruviAmnon Kruvi
Hi Jonathan,

Have you verified the process is not executing entirely by generating a debug log? It could be that the record does not meet the defined criteria, giving the impression it is not firing.
Jonathan MillsJonathan Mills
Hi Amnon, 

Thanks for the quick response - We added a debug node to the Process Builder that would update a description field with the time the PB most recently ran (with no criteria - just run on case edit) and this indicates that despite the entitlement and trigger updating 2 checkboxes, the Process Builder doesn't run.
Amnon KruviAmnon Kruvi
I see. Despite this, I would still advise to create a trace flag and generate a debug log for the operation - at the very least you will see for certain whether the process is being called.
Jonathan MillsJonathan Mills
We have run debug logs and confirmed the Process Builder does not fire from SLA/entitlement actions.

One of our dev's has built a workaround with a Case trigger that calls a future context method to update a secondary field (case.FirePB__c).  That resets the whole execution context, i.e. starts over from the beginning as a pure field update, not a field update from an entitlement action... so it's not a great solution since it then refires all the Case workflow rules/triggers/PBs, but it appears to work in the Case trigger's "After" context.

This feels like a bug that should be possible decleratively.

For reference, here is our trigger solution:
 
trigger CaseTrigger on Case (before insert, before update, after insert, after update) {

    if (Trigger.isAfter) {
        Set<Id> idsForTestFieldUpdate = new Set<Id>();
        
        for (Case c: trigger.new) {
            
            // if [field set by workflow action] changed to true:
            if (c.[field set by workflow action] == true && (Trigger.isInsert || Trigger.oldMap.get(c.Id).[field set by workflow action] == false)) {
                idsForTestFieldUpdate.add(c.Id);
            }
        }
        if (idsForTestFieldUpdate.Size() > 0 && !System.IsFuture()){
            // fire future context handler to update these cases and set FirePB__c to true, to get the PB to fire
            // (note this is being done as a workaround to get a PB to fire after an entitlement field update on a case)
            CaseTriggerHandler.UpdateTestField(idsForTestFieldUpdate); 
        }
    }
}

and it's handler:
 
public class CaseTriggerHandler {
    // Future context method to get PB to fire via setting FirePB__c to true
    // (Note this is being done as a workaround to get a PB to fire after an entitlement field update on a case)
    @future
    public static void UpdateTestField(Set<Id> caseIds) {
        
        List<Case> casesForUpdate = new List<Case>();
        for (Id caseId : caseIds) {
            casesForUpdate.add(new Case(Id = caseId, FirePB__c = true));
        }

        update casesForUpdate;
    }
}


 
Maria HuemmerMaria Huemmer
It looks like this is a known issue. https://success.salesforce.com/issues_view?id=a1p30000000SU70AAG
This was selected as the best answer
Jonathan MillsJonathan Mills
Thank you Maria!! good to know