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
Globe Salesforce AdminGlobe Salesforce Admin 

Create Multiple Records in a Flow

Hi,

 

I started building a flow to Create a Project Record, with multiple Milestone records and related Task records. Everything was going fine, until i added my 15th Record Create Element and starteg getting Apex Governor Limit Warnings:

 

Operation: /flow/interview.apexp

Caused the following Apex resource warnings:

 Number of SOQL queries: 97 out of 100

 

Is this happening because i'm creating too many records in the flow? 

If so, what are my options? Should I create subflows for each Milestone/Task Record grouping and embed them into a Master flow? Or does this require an Apex Plug-in?

 

Thanks,

Jennifer

 

 

DarrellDDarrellD

It's not specifically happening because you are creating 15 records, but there is other stuff going on in the Flow as well that's putting you over the limit. You are technically ok at 97/100 but you need to see how many lookup and other types of statements you have that query the DB.

 

Breaking into subflows isn't going to change anything I don't think. I'm pretty sure that's all 1 transaction regardless. You'd have to put a little more info on what's in your Flow so we can understand why you have 97 queries. Make sure you are being "efficient" when doing your queries and lookups as a general start.  No, you cannot create multiple records at one time, yet, with a Flow but are there other areas of the Flow you could make "better".

Globe Salesforce AdminGlobe Salesforce Admin

Thanks for getting back to me.

 

I have a sequence of elements like this:

 

Record Create: Project

Record Create: Milestone1, where Milestone looksup to ProjectID

Record Create: Task1, where Task looksup to Milestone1ID

 

Record Create: Milestone2, where Milestone looksup to ProjectID and looksup to Predecessor Milestone1ID

Record Create:  Task2, where Task looksup to Milestone2ID

Record Create : Task3, where Task looksup to Milestone2ID

Record Create : Task4, where Task looksup to Milestone2ID

 

(On the 7th Record Create, I get the Governer Limit Warning)

RajaramRajaram

Every time you create a record, apex triggers on the record will kick in.

So, if you have a lot go apex code and there are a lot of queries in those triggers, each time you are running a record create element, you are adding to the apex governor limits.

 

Try making the apex triggers inactive and see what happens, I bet you will not get the governor limits.

 

In a nutshell, you need to find the balance between Flow and Apex and see how you can design with both in mind.

psrpsr

Pls tell me  data loader  dis advantages