0

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.

4 Answers 4

1

It is a reported known issue, refer to: https://success.salesforce.com/issues_view?id=a1p30000000SU70AAG

1

Future method works. Here is my code if anyone stumbles on this and never did any future method.

public class UpdateSLA{
     //Call async from triggers, etc, where callouts are not permitted.
        @future(callout=false)
        public static void updateFuture(String strnewMap) {
        map<id, Case> newMap = (Map<id, Case>) JSON.deserialize(strnewMap, map<id, Case>.class);
            
        List<Case> updateCase = new List<Case>();
        List<Entitlement> entitlements = [select id from entitlement where name = 'entitlement 01'];
        List<Case> listCases = [select id,expired__c,extended__c,EntitlementID from case where Id =: newMap.values().Id];
        Boolean isExpired = false;
        if (!listCases.isEmpty() && !entitlements.isEmpty()){
            for (Case obj : listCases) {
                if( (obj.EntitlementID != null && obj.EntitlementID != entitlements.get(0).Id) && (obj.expired__c == 'Yes' || obj.extended__c == true))  {
                    obj.EntitlementId = entitlements.get(0).Id;
                    obj.extended__c = true;
                    isExpired = true;
                    updateCase.add(obj);
                }
            }
        }
        if (isExpired) {
            update updateCase;
        }
    }
         
         
}

And my trigger (on case):

if(Trigger.isAfter && Trigger.isUpdate && System.IsBatch() == false && System.isFuture() == false){
        String jsonNewMap = JSON.serialize(Trigger.newMap);
        UpdateSLA.updateFuture(jsonNewMap); 
    }
0

Order of execution sounds like it may be the cause. You could test making the field update a scheduled action with a delay of one minute instead of an immediate action. That might resolve this issue.

1
  • Hey Scott, yes this is our suspicion as well. I don't think it's possible to add delays in the milestone action and delays in the PB doesn't work. Our dev has built a workaround with a trigger that calls a future context method to update a secondary field. This resets the whole execution context, i.e. starts over from the beginning as a pure field update, not an update from an entitlement action. This feels like a bug that should be possible declaratively. Aug 29, 2018 at 14:39
0

I found the workaround of this issue to call field update in Future method. It worked for me.

1
  • can you explain with sample..
    – Ragul
    Oct 6, 2021 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.