1

I have a basic flow - screenshot attached.

It works great, except at times I receive an exception error that says: This error occurred: LIMIT_EXCEEDED: System.LimitException: Too many SOQL queries: 101.

All the flow does, is upon a completed task, the flow triggers, then gets all the tasks with the What ID that is related to that any object record that triggered the flow, that then updates a date field. Do I need to add a loop somewhere, because I do not know how a limit is getting hit with this basic of a flow?

3
  • Does this answer your question? How to avoid too many queries in Flows
    – identigral
    Commented Aug 2, 2022 at 18:11
  • Welcome to SFSE. Please take a moment to read How to Ask and take the tour. Please edit your post to include more details. Is the flow triggered on Task or Opportunity? Please also include details or screenshots of each element. Commented Aug 2, 2022 at 18:26
  • The flow is triggered on a Task and only if it is related to an Opportunity. The next step is to get all the tasks related to the Opp and only have the last completed task due date stored and then simply update the opportunity date field. @DavidCheng. Hopefully this helps
    – Need Help
    Commented Aug 2, 2022 at 18:36

1 Answer 1

3

SOQL limits are cumulative across an entire transaction. You likely have a trigger or other flow somewhere that's triggering the error. Unfortunately, you're going to have to learn how to read debug logs and do some profiling.

⚙️ -> Developer Console (new window) ➡️ Debug ➡️ Change Log Levels... ➡️ Add/Change (top row) ➡️ Add ➡️ Set all columns to NONE/ERROR, PROFILING set to FINEST ➡️ Add ➡️ Click Profiling ➡️ Done.

Setup

Developer Console Menu

Change Log Levels

Add Log Level

Set Profiling

If you've followed these steps appropriately, you should see this:

Profiling Enabled

Notice how the General Trace Settings for You table shows Profiling under DebugLevel. That means you've set it up correctly. Click Done to finalize your changes.

From here, you can just run your flow, and when you get the error, use the Logs tab to open up your log. You'll get a text file containing information about total CPU usage, query usage, etc. You'll just need to check this profiling data to see where most of your queries are being used.

Note that this may be one of those cases where the "victim" is usually an innocent bystander. For example, if you have a trigger that uses 99 SOQL, and the flow runs afterwards, it may have only used 2 queries, but it gets the blame, since it is when you ran out of usage limits. You'll need to profile the entire transaction to figure out what went wrong.

You must log in to answer this question.

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