Questions tagged [bulkification]

The practice of structuring code to handle processing multiple records in one transaction. It should scale from processing a single record to hundreds (or more).

Filter by
Sorted by
Tagged with
0 votes
1 answer
75 views

Apex Bulkification Issue

I have an SObject variable in which I'm adding the field api names and the values respectively as it acts as a Map and later adding it to a List<SObject> variable. The below code works as ...
apz's user avatar
  • 407
1 vote
1 answer
78 views

How Salesforce executes a flow on a record triggered plus subflow vs only record triggered

I was wondering if someone here could help me have a bit more clarity over a behavior I'm seeing when executing flows in SF. I need to call a subflow from a record-triggered flow to execute some ...
David de León's user avatar
0 votes
2 answers
47 views

Not sure if code is perfectly written for bulkification inside invocable method

I have been reading a lot of bulkifying code inside of the invocable methods both here at stack exchange and outside. More reading has led to a lot of confusion and still not sure if I have done it ...
sumchans's user avatar
  • 777
1 vote
1 answer
101 views

Flow Bulkification with respect to duplicate Update Records on the same parent record

I'm designing a flow to roll up values to a parent record, and although I've reviewed the documentation here on bulkification, there is a piece that I haven't quite figured out. The flow will run upon ...
boop's user avatar
  • 13
0 votes
1 answer
55 views

Inserting List of ContentVersions and ContentDocumentLinks at the same time

I'm looping through a list of records, creating content versions, adding to a list of content versions and then inserting the list of content versions. I then need to create a content document link to ...
Joe Hayes's user avatar
  • 372
0 votes
2 answers
57 views

If a user can access only the salesforce UI, will there be multiple transaction for that user?

Please correct me if I am wrong. Somewhere I read an article that each account has their own separate transaction. Also, I don't think that customers will be using Developer Console to update or ...
ratRiot01's user avatar
0 votes
1 answer
133 views

Do I need to Bulkify a DML inside a loop followed by end in Flows

I have a flow that only fires once per case record when an email-to-case comes in. It finds the email alias the case came through and assigned some values to the case record. I'm assessing a flow that ...
eHarazi's user avatar
  • 133
0 votes
0 answers
79 views

Trying to understand how to bulk update via a schedule trigger flow

I created a schedule trigger flow to update 1000s of opportunities every night. The job of this flow is to find any inactive opportunity and close-lose it. However, I am hitting "...
Ty Haas's user avatar
-1 votes
1 answer
63 views

Independent Bulkification vs Batched Processing

I have been acquiring quite a bit of information about how bulkification and batch record processing works in salesforce (bits and pieces - salesforce documentation does not seem exhaustive). While I ...
Luke Sharon's user avatar
3 votes
1 answer
328 views

Salesforce Bulkification Across Transactions

Here is a fun question I have been puzzling over. So, I have been learning a lot lately about salesforce bulkification and governor limits, specifically as they relate to bulk upload of data into ...
Luke Sharon's user avatar
0 votes
1 answer
766 views

Help bulkify salesforce invocable method (called from flow)

I have a very basic invocable action that is used by a flow to return the useraccess record if the user has edit rights (if not, the return would be a null list - barring sysadmin users of course). I ...
Ben's user avatar
  • 13
1 vote
0 answers
14 views

Avoid iterating over list inside loop [duplicate]

Hello guys I have two lists. One has contact records and other has ContentVersion records. What I need to do is that by every contact I have to create a documents and attach to them by using the ...
TechGuy's user avatar
  • 97
-2 votes
1 answer
58 views

How to bulkify the code, I am facing Too many SOQL queries

The most common error any developer faces is Too Many SOQL queries while working on Trigger. In this code I am facing Too many DML on line AggregateResult. trigger DrawingSharing on Drawing__c (after ...
apz's user avatar
  • 5
1 vote
2 answers
402 views

Mark custom object record as duplicate via Apex for large (100,000+) data sets

Let's say I have a data load that inserts 100,000 unique records of a custom object - call it MyObject__c. Each record has a lookup to a Contact record that is populated. I want to iterate over the ...
SCVandal's user avatar
2 votes
3 answers
299 views

Looking for documentation that explains when SF sends multiple records to a Trigger

I've been writing trigger code for years so that it handles multiple DML events for a long time. I've been trying to find documentation that explained when SF would bundle multiple DML events ...
Michael Sobczak's user avatar
2 votes
2 answers
5k views

Salesforce Scheduled flow bulkification best practice/ clarity

I have a question about bulkifying scheduled flows. When you create one you have two options. Use a get element to grab the records you want or set an object & conditions. I've found the ...
Thomas Gunn's user avatar
0 votes
1 answer
427 views

How can I use map.keySet() and map.values() in one SOQL?

I have a map like this: Map<ID,List<ID>> invs = new Map<ID,List<ID>>();. I am trying to delete like this: delete [SELECT ID FROM Invoice__Share WHERE ParentId IN :invs.keySet() ...
TomaszOleszko's user avatar
-2 votes
1 answer
363 views

How to do bulk updates using a map?

This is a contact trigger handler updating the account. The aim is getting the most common email domain and rolling that up from the contacts to the account. I'm doing this by looping through the ...
NJW's user avatar
  • 3
1 vote
1 answer
923 views

Flows with flow bulkification to check if record exists

I am creating a flow which can be invoked in bulk mode with multiple records. I have read the help articles for automatic flow bulkification, and have a good idea what's going on. I have a ...
hamayoun's user avatar
  • 2,747
2 votes
1 answer
1k views

Is it possible to use a date range as map's key and then use a date to find the entry?

I have a list of records that map to a particular date range. For eg: 1 Jan 2020 - 31 Dec 2020 -> Toyota, Aston Martin 1 Jan 2021 - 31 Dec 2021 -> Red Bull, Mercedes, Ferrari 1 Jan 2022 - 31 ...
N_H1922's user avatar
  • 315
0 votes
2 answers
809 views

Flow Invocable Apex- Error when running flow in bulk

I am trying to run a record triggered flow when multiple records are created. What I have now, works perfectly until I try to enter more than one Record at a time. I get the following error: The ...
user avatar
0 votes
0 answers
2k views

Flow to create multiple tasks for different queue

Use Case When an Opportunity Stage is changed to "Approved" , create multiple Tasks and assign to different Queues - Create Task for 'Customer Management Queue' Create Task for one or ...
GroundToCloud's user avatar
2 votes
1 answer
580 views

Hitting governor limits and getting the "Apex CPU time limit exceeded"

I had to write a trigger to manage a lead deduplication process designed by someone else. In a nutshell: A lead gets inserted Checks on name and email of existing leads and contacts (person accounts) ...
robruf's user avatar
  • 362
1 vote
0 answers
43 views

Is it possible to POST multiple Tooling SObjects with a single request? [duplicate]

I've seen and tested that I can create or update single records of TraceFlag (for example) using "/tooling/sobjects/SObjectName/". However, years of working with Salesforce has ingrained in ...
Brian Kessler's user avatar
1 vote
1 answer
903 views

Record Triggered Flow trying to create duplicate records

I have a record triggered flow that needs to create related records if they do not already exist. However, once the record is created, if other records in the transaction would have triggered a create ...
Peter Andronakos's user avatar
1 vote
1 answer
2k views

The number of results does not match the number of interviews that were executed in a single bulk execution request

I'm getting this error when I insert more than one record into an custom object that has a record-triggered Flow. Flow calls an invocable method to do parse multipicklist values. here's my invocable ...
merve-bulut's user avatar
0 votes
1 answer
813 views

Prevent bulk flow execution from creating duplicates

I have an Article__c custom object. That article can appear on several Publication__c objects, Publications having a Language__c field. When the Publication__c record is set active, I need to create ...
Emmanuel BRUNO's user avatar
0 votes
1 answer
66 views

Send value from picklist to APEX

I am pretty new to Apex and VF (started about 10 hours ago), have close to never coded before, and I have this problem I need to solve: The ultimate goal is to be able to select multiple Account ...
Hans Rogg-Desormeaux's user avatar
0 votes
1 answer
738 views

Flow using @InvocableMethod fails when inserting multiple records

I have an Apex class that matches Lead records to existing Contact records based on a phone number input. I'm using @InvocableMethod to include it in a Flow. The Flow works as designed when I insert a ...
JaredC's user avatar
  • 93
-1 votes
1 answer
436 views

If we installed the package for all users, but we want the tabs access be removed from every profile, how can we achieve that?

My clients ask me. If we installed the package for all users, but we want the tabs access be removed from every profile, how can we achieve that? Is there any faster way rather than going manually ...
Patlatus's user avatar
  • 16.5k
0 votes
2 answers
95 views

Need help moving SOQL out of the loop

Hello, I need move this query out of loop: List<Lead> dupeLeads = [SELECT Id, Email FROM Lead WHERE Id != :Ld.Id AND Email =: Ld.Email]; I'm testing various guides on "bulkifying ", ...
Alberto Jiménez Domínguez's user avatar
1 vote
1 answer
614 views

Avoid bulkification in flow

I update/create (upsert via sf-dataloader) each day the data of our contracts. These contracts (customobject EZR) contain the lastname, surname, birthdate etc... I create an ID with this data (sample ...
Rag21's user avatar
  • 105
0 votes
0 answers
117 views

Visualforce Page (render as Excel) SOQL Limit Exceeds

Here we want to generate Excel for Every record created/Edited of an sObject. Here we are using VF Page to generate an Excel and then store it in Documents/Attach File Object. So the Flow looks like ...
Kartik Gupta's user avatar
3 votes
0 answers
714 views

Scheduled Flow Not Running for All Records

I am hoping someone can help me with Schedule-Triggered Flows (STF). I have created a STF that gets all leads matching a specific criteria. The flow then checks the record type of the lead. If (Record ...
Kev Cadger's user avatar
1 vote
1 answer
496 views

Autlolaunched Flow bulkification prevents correct update

I have built a autolaunched flow that is triggered by a process builder related to a custom object. The custom Object is a child object to Account. The use case I am trying to solve is that on the ...
Robert Méndez's user avatar
0 votes
1 answer
103 views

Bulkify Aggregation Trigger

Is there a way to combine the two aggregates below. public class AccountClass { public static void UpdatePartnerRollup(List<ID> AccID){ // Get Opp Account Map<Id, Account&...
Laura Bejjani's user avatar
2 votes
0 answers
362 views

Salesforce Bulk API Failing Journey Builder Process Builder

For Context: The Salesforce Org is connected to SFMC via MC Connect. We are writing Bulk API to perform ETL on Opportunity/Lead/Account Objects in Salesforce. In Marketing Cloud there are journeys ...
PrinceTiwari's user avatar
0 votes
1 answer
344 views

How Bulk Creation of Custom Objects can be implemented?

How Bulk Creation of Custom Objects can be implemented? Assuming we need to replicate and debug a case where there are 3000 custom objects in the customer org. To replicate this situation, we could ...
Patlatus's user avatar
  • 16.5k
0 votes
1 answer
632 views

Time-based workflow causing Flow with Email Alerts to fail

I have a time-based workflow that checks a checkbox on an Account which causes a flow to run and send a set of emails to maybe 1-6 contacts via Workflow Email Alerts. The end of the flow un-checks ...
Richard Durrant's user avatar
0 votes
1 answer
62 views

Please help with Bulkify code [closed]

I need some help to bulkify following code. It works for 1 record when a user would change the field but I am worried that it would hit Governor limits as soon as bulk data load would occur. I am not ...
sw007's user avatar
  • 3
0 votes
2 answers
110 views

How to bulkify a trigger with many dependent SOQL queries

In our org when we clone a case we would like to bring with it only the most 20 recent email messages and attachments. This is to avoid encountering heap size limits. The below is the code that ...
Luke Bray's user avatar
  • 506
3 votes
1 answer
15k views

Do record triggered flows run on multiple records?

I'm trying to implement some logic that I would normally use Apex for, but decided to try record triggered flow so that it would be easier for an admin to turn on or off. When I create a record ...
hgolov's user avatar
  • 733
0 votes
1 answer
36 views

Trouble Bulkifying Trigger Utility Class

I have a utility class for a trigger on a custom object (Territory) that is meant to query all the Territory records for an Account when a Territory record is updated. It then either sets a custom ...
J. Neilan's user avatar
  • 1,243
0 votes
1 answer
35 views

Bulkified Class?

I have a utility class for a trigger on a custom object that queries the custom object records for an account when one of the custom object records is updated and then sets a custom checkbox field on ...
J. Neilan's user avatar
  • 1,243
0 votes
1 answer
328 views

Updating Child records in bulk

I am trying to update the children records when the parent field is updated. The code I have works but I was wondering is it the optimized for data loads. So if a user uploads 1000 Lease records and ...
Phuc's user avatar
  • 125
1 vote
0 answers
730 views

Please Help Build a List of Flow Limitations

(long post – sorry) Hoping to solicit some feedback about flow limitations to establish some clear thresholds for when to use them versus APEX or custom Lightning Components (Web or Aura). I and a few ...
Peter's user avatar
  • 11
0 votes
1 answer
103 views

Trigger not working on Bulk records properly

**Requirement** - Requirement is to generate a random number(not sequential) for every case getting created, provided number remains unique in salesforce database. The number is then appended with ...
KKumar's user avatar
  • 19
0 votes
0 answers
39 views

Narrowing a selection based on values in a Map<String,String>

Each day, I want to... Upsert new/changed time logs via Apex. Generate a Map where key = Jira_Issue_c, value = Activity__c Find previously created records matching Jira_Issue_c but not Activity__c ...
nstuyvesant's user avatar
10 votes
1 answer
2k views

How do I bulkify queries for directly or indirectly related records?

This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through ...
1 vote
1 answer
532 views

Apex Bulkification -- Too many SOQL queries: 101

I have an APEX Class that I have bulkified but is still giving me trouble with Batches of 200 Records. I was hoping to get assistance in making the APEX more efficient, any assistance/direction would ...
Max's user avatar
  • 486

1
2 3 4 5