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
Marco Rosa 3Marco Rosa 3 

Flow bulkification limit ( and FLOW_BULK_ELEMENT_LIMIT_USAGE)

Hello Everybody,
I have a question about Bulkification in Flows.
I do not understand how exacty bulkification works as explained in this article: https://help.salesforce.com/articleView?id=vpm_admin_bulkification.htm&type=5

I created a little test:
1) I have a flow called CaseFlow 
User-added image
The flow has 1 input (caseId).
In the first block I query for the case with Id=caseId.
In the second block I insert a child case of the retrieved one.
2) I call the flow 400 times with the following code:
        List<Case> cases = Database.query('Select id from case limit 400');
        for(case c : cases){
            Map<String,Object> inputs = new map<String,Object>{'caseId' => c.Id};
            Flow.Interview.createInterview('CaseFlow', inputs).start();  
        }    

How many DML am I performing with this code?

In the log (In the debug level, set Workflow to Finer) I have something like:

11:05:54.705 (38705612167)|FLOW_BULK_ELEMENT_LIMIT_USAGE|1 DML statements, total 400 out of 150
11:05:54.705 (38705630521)|FLOW_BULK_ELEMENT_LIMIT_USAGE|1 DML rows, total 400 out of 10000
11:05:54.705 (38705704180)|FLOW_BULK_ELEMENT_END|FlowRecordCreate|CreateChild|1|43

I do not understand if the execution of the flow interviews count as separated (and I am executing 400 DML out of 150) or they are bulkified and I am executing a fewer number of DMLs (in this case, which is the batch size)???
I am successfully creating the 400 child cases so, apparently, I'm executing 400 DMLs.....

Thank you in advance
Marco