4

I have a simple flow that changes the owner on an opportunity to the account owner upon creation. It is called from process builder when the opportunity is created. Three simple steps: 1. Lookup Opportunity (to get account id) 2. Lookup Account (to get owner) 3. Update Opportunity (with owner)

It works fine when adding opportunities from the UI or in small batches but any large load causes too many SOQL queries. My opportunities are coming from another system so I have to be able to handle volume. I have no loops in the flow and can't batch because it is triggered by process builder. Any ideas would be appreciated.

5
  • 1
    Take a look at salesforce.stackexchange.com/q/53481/9853 I presume you are doing a lookup within the flow. If you are inserting 200 records it will actually run 200 queries. So you need to pass the ids into a collection then loop through that rather use a lookup.
    – Girbot
    Feb 8, 2015 at 9:02
  • If the above doesn't help please provide a screenshot of your flow.
    – Girbot
    Feb 8, 2015 at 9:03
  • I did try this as well to no avail. Feb 18, 2015 at 19:23
  • I also have a need to update owner for all accounts and all related opportunities based on a change in region (custom field). I can't figure out how to remove the oppty lookup from within the loop (i.e. find all accounts, put in sobject collection, loop through collection, find all opportunities). In a trigger we would collect the ids and then the lookup would be a match within the list of ids. Tried to do that in a fast lookup with no success Feb 18, 2015 at 19:26
  • I've noted that Process Builder does not play well with bulk data updates. The only way I've managed to get around this is to reduce my batch size to about 10 (where the default on something like dbAmp or dataloader.io is 200). I've brought it up over on the SFDC collaborate groups and ideas forum, hopefully this will get rectified in the future.
    – 44f
    Feb 19, 2015 at 9:39

2 Answers 2

1

According to Salesforce : https://help.salesforce.com/apex/HTViewSolution?id=000230650&language=en_US

You need to reduce your chunk sizes to low numbers - 1 will always work, while some envs can also support 20 .

1

When data loader inserts/updates records, process builder runs for each record. That means that if you have 200 records, you will run into limits even if you have 1 query. Here are some possible solutions:

  1. Change to a Trigger. Triggers will handle the data in batch form. You could delete the process and create the trigger. While Salesforce is big on Code over Clicks, I would argue that this is the best solution because if effectively covers all your use cases (loading many and few records) in a simple fashion.

  2. Limit Batch Size. I know it isn't the most elegant solution, but if you know how many records you can update at a time and you don't have thousands of them, it may be doable to just upload what you can.

  3. Temporarily Disable the Process. Many people have a custom checkbox on objects along the lines of "Bypass Validation" or similar. Their triggers and processes have been set up to ignore a record if the value is true. If you haven't done that, you may want to consider doing so, but a short term fix is just temporarily disabling the process. You can then find the affected records via the developer console and fix with either a second data load or manually modifying those records.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .