function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

bulkify flow trigger or disable during mass update

I'm new to flow trigger. I created a flow trigger that does some updates on user object. This is fired by a workflow when new user is created and updated. This works fine when insert and update is done on single record. I have external program that does a mass updates on user object. I get Too many SOQL's: 101 error on flow when there is mass update.  
Is there a way to disable the qwork/flow during mass updates ?  
Is there better way ?

Thanks for help. 
SonamSonam (Salesforce Developers) 
As you are doing mass update, you seem to be hitting the governor limit as explained in the link below:
Amit Chaudhary 8Amit Chaudhary 8
Hi ED055,

All the triggers fired will be counted in a single context or call. We need to ensure that total number of SOQL fired should be less than 100.
In order to by pass this, you need to change your code in such a way that SOQL fired must be less than 100 or if you need to change the context then you can use @future annotation which will run the code asynchronously.

You need to make sure that the SOQL query you are using should not be inside the for loop

1. Read this article carefully:
2. Make sure you don't have a recursive loop calling a SOQL.
3. Do not do any DML/CRUD inside a for loop.
4. Use System.Debug() to ensure what you are fetching is what you should be getting.
5. Make use of the Debug logs/Developer console. Debug it, and you will figure it out.

Related Link :-

Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help

Amit Chaudhary