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
59 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 ...
  • 3
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 ...
  • 77
-2 votes
1 answer
48 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 ...
  • 5
1 vote
2 answers
91 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 ...
2 votes
3 answers
158 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 ...
2 votes
1 answer
445 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 ...
0 votes
1 answer
82 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() ...
-2 votes
1 answer
135 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 ...
  • 3
1 vote
1 answer
236 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 ...
  • 2,663
0 votes
0 answers
27 views

Updating date value for open records at the start of each month

I have a flow that is designed to update a record at the start of each month if the record remains open. I.e. Billing Month = 1 August, come Sept if that record status is still "Open" then ...
2 votes
1 answer
482 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 ...
  • 313
0 votes
1 answer
251 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
857 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 ...
2 votes
1 answer
323 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) ...
  • 307
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 ...
1 vote
1 answer
384 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 ...
1 vote
1 answer
1k 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 ...
0 votes
1 answer
355 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 ...
0 votes
1 answer
57 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 ...
0 votes
1 answer
362 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 ...
  • 53
-2 votes
1 answer
204 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 ...
  • 14.8k
0 votes
2 answers
87 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 ", ...
1 vote
1 answer
338 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 ...
  • 95
0 votes
0 answers
70 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 ...
3 votes
0 answers
511 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 ...
1 vote
1 answer
294 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 ...
0 votes
1 answer
96 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&...
2 votes
0 answers
233 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 ...
0 votes
1 answer
206 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 ...
  • 14.8k
0 votes
1 answer
459 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 ...
0 votes
1 answer
61 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 ...
  • 3
0 votes
2 answers
88 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 ...
  • 466
3 votes
1 answer
9k 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 ...
  • 671
0 votes
1 answer
35 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 ...
  • 1,213
0 votes
1 answer
33 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 ...
  • 1,213
0 votes
1 answer
183 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 ...
  • 125
1 vote
0 answers
446 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 ...
  • 11
0 votes
1 answer
88 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 ...
  • 19
0 votes
0 answers
36 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 ...
10 votes
1 answer
1k 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
483 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 ...
  • 476
5 votes
3 answers
4k views

Bulkification of Flow with invocable action - error re: number of results - how do I resolve?

I'm getting the error "The number of results does not match the number of interviews that were executed in a single bulk execution request" when I insert more than one record into an object ...
  • 53
0 votes
1 answer
55 views

Help understand Apex class / bulkilfy

I posted another question here: Help troubleshoot Flow hitting governor limit looks like the apex class we are using may need bulkify, can anyone point me in the right direction as to how to extend ...
3 votes
1 answer
290 views

Handling batching in new Summer '20 Platform-Event Flows

We are planning to use the new Platform-Event Flows once Summer '20 is released next week, but I have a question around batching. Currently we use apex triggers to handle platform events. Those can ...
  • 170
0 votes
1 answer
730 views

Mass upsert Master Detail records at the same time

I have two custom objects with Master Detail relationship. I need to be able to bulk upsert these records simultaneously. For example: If the master records don't exist, create them. Otherwise, ...
  • 25
0 votes
0 answers
406 views

Do customer community/customer community plus licenses have access to Data Loader/Data Import Wizard?

I want to know if customer community or customer community + user licenses have access to data transfer applications like Data loader or Data Import Wizard? If not, is APEX driving custom component ...
2 votes
1 answer
984 views

How to bulkify a flow launched FROM Apex Trigger?

I am launching a flow from APEX and I want to pass it a list of IDs. The issue that I am coming across right now is that I will need to look up each ID in the flow because there is no "IN" clause for ...
0 votes
1 answer
112 views

Fill lookup via foreign key after insert

Problem: I have an external service bulk inserting a task and including a foreign key to my table business. The service will be creating ~100-500 tasks at a time. I'm trying to build a bulkified ...
  • 143
0 votes
1 answer
142 views

A Batch class for trigger? Or there is another solution?

I have a trigger for many records. In my unit test there is no problems with 1500 records. But I'm getting the 'Apex CPU time limit exceeded' error with 1800 and more records. Is Batch the only ...
  • 45
0 votes
1 answer
497 views

How to bulkify trigger when I have to query using a field in Trigger.new?

I am writing a trigger for a custom object (Subscription__c), where I need to find other records of the same object that share a lookup to Contact (field name: Subscriber__c), and copy some ...
  • 17

1
2 3 4 5