2

What is a valid robust use case for Process Builder when doing record updates?

I've been running into an issue recently where every record update causes 1 SOQL and 1 DML per record which meets the criteria. We have some fields which we are manually calculating due to some other limits (rather than using formula fields). As such, it's like we could have 200 records out of the 200 context hit the true criteria causing all records to update. As such, we hit SOQL 101.

According to the following idea, Bulkification has already been addressed: https://success.salesforce.com/ideaView?id=08730000000DhBlAAK

Am I doing something wrong, or is this just the limitation of using Process builder? Does this mean I am relegated to using Workflow rules again for this? How can I trust that process builder is not going to screw me in other areas too?

  • This is pretty much a current platform limitation. There are some cases where you are still forced into using triggers as Apex is much more robust with the handling of bulk data. – Dave Humm Apr 24 '17 at 7:58
  • 3
    I ran into same issue and after raising case with SFDC support I got to know that bulkification of flow was disabled for my org. That setting is not visible to customer. Please raise a case and enable this feature. – Himanshu Apr 24 '17 at 8:30
  • 1
    That is correct – Himanshu Apr 24 '17 at 18:05
  • 1
    @Himanshu - do you want to turn that into a proper answer? – Dave Humm Apr 25 '17 at 8:07
  • 1
    @BenNaylor I know this is very frustrating. Tier 2 support is not knowledgeable (I don't want to generalize my statement but this is true) enough. They don't know how things work in SFDC. he told me that you can't put query inside flow and when I showed him visualflow documentation which says that Salesforce handle bulk update automatically then he was surprised and later acknowledged. – Himanshu May 10 '17 at 7:12
3

This happens because Bulkification of flow sometimes disabled for org. I ran into same issue and after raising case with SFDC support I got to know that bulkification of flow was disabled for my org.

That setting is not visible to customer. Please raise a case and enable this feature for your org. You also need to raise case for every higher environment if you are asking to do this in dev.

  • Just got word, if you include: "Enable query optimization in bulk mode" in your case, it should get through quicker for people facing this problem in future. You can also reference my case #16297584 which mentions the issue and the fix :-) – Ben Naylor May 10 '17 at 8:20
  • 1
    I can confirm that this setting exists and Salesforce support just enabled it for our orgs in order to get this process builder stuff working. – ebi Mar 8 '18 at 15:29
-1

Consider using Record Update or Fast Update of the flow that allows bulkification.

  1. Create a Autolaunched Flow that with appropriate input parameters and use record update element to update the records.
  2. On successful testing, activate the flow
  3. From the process builder pass the input parameter so that the flow will do the update
  4. Refer to record update as an example
  • I'm pretty sure this will still hit the limits as each record in the context is going to go through the flow, and thus each is going to cause the record query and record update calls. Can you provide an example of where you have done this and it works with a batch of 200 records? – Ben Naylor May 1 '17 at 14:19
-2

I faced the same issue and seems to me handling large data through Process Builder is not a good option. What I did -

  • Configured Process Builder to run on record create or update
  • Then for those records meeting the criteria, passing the list to InvocableMethod. From there instead of doing one single update, I performed bulk update through Database.update().

But to your point "every record update causes 1 SOQL and 1 DML per record which meets the criteria" - seems to me the portion of the code which is triggering 1 SOQL and 1 DML Per record needs to be bulkified. Consider putting the logic in trigger and then with minimal changes you can make that portion of the code bulkified as well.

Refer - Best Practice: Bulkify Your Code

  • There is no trigger code at present. The 1 SOQL and 1 DML is caused per record by process builder update records action. Ninja edit: You will also find that InvocableMethod is called per record, and thus also doesn't work. At least this is what I've read online. – Ben Naylor May 1 '17 at 14:16

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.