Questions tagged [batch]

Classes implementing the `batchable` interface are used when there is a need to operate on a large number of data records which would normally be problematic due to the imposed governor limits.

Filter by
Sorted by
Tagged with
0
votes
0answers
20 views

Using BatchApexErrorEvent vs custom platform event on error

Working with a consultant on a batch class that performs operations on the user object. We are working on implementing error handling. We must use platform events to handle errors to avoid mixed DML ...
0
votes
1answer
26 views

Map giving same data of object while using loop [closed]

I am using a batch class where data iterated over an object Sample batch for(Object1__c obj : scope) { ltmsTrackingList.add(obj.Id); system.debug('obj Id' +obj.Id); } for(...
2
votes
1answer
37 views

Prevent limits in a callout intensive process where client can only receive one request at a time?

I have a callout intensive process where the client can only receive one request at a time and I'm having a hard time identifying what is the best practice for asynchronous solutions to handle this ...
0
votes
1answer
19 views

Test method not able to execute __r relationship

Batch class giving null for PID_SL__r.PID_SL__c field. PID_SL__c is a field on service location which is parent object. Please find my Test class below : @isTest public class BatchTest { public ...
1
vote
1answer
18 views

Add Contacts to Campaign as Campaign Members using batch class

I have a requirement where I need to add Contacts to a specific campaign record as campaign members when the status(Custom Field) of Contact is Closed Lost. I was stuck as adding contacts to campaign ...
0
votes
2answers
31 views

Email Limit Exceeded on Batch Apex

I have a batch job which sends email notification in bulk using Messaging.sendEmail() and its using setTargetObjectId to set the reciepient. It sends out thousands of emails but one day I got case ...
0
votes
0answers
23 views

how to soql query from ContentDocumentLink for batch? [duplicate]

i'm struggling with understanding the logic behind this query i need to do for a batch job. i am querying the contentdocumentlink object because i need to capture files (potentially multiple) related ...
1
vote
0answers
28 views

Apex Job Gets Stuck Processing

I have the following problem. There is an Apex Scheduled job that runs everyday at 2AM that gets stuck during processing. As seen in the image below, the batch process reaches 330 and then stalls ...
0
votes
2answers
32 views

Cannot make callout from a Trigger that is fired through a batch apex

I'm trying to call a method which do an api call. But I'm getting an error because this method get call through the process ran by batch. So even if I directly call the API calling method it gives me ...
0
votes
1answer
27 views

how to write test class for batch class ? this covers only 44% [duplicate]

how to write test class for batch class ? this covers only 44% global Class Batchsample implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database....
-2
votes
1answer
28 views

Apex Job Error: can't parse argument number: org

can someone please help me with this issue can't parse argument number: org: This is the Batchable class: global with sharing class IMB_SendPushNotificationsBatchable implements Database.Batchable<...
0
votes
0answers
31 views

Fetch Linked Contact details of Account

I am writing a batch, which essentially iterates over account records. following steps. iterate over account based on specific conditions if the account has a linked account to it(lookup to account), ...
4
votes
0answers
102 views

AsyncApexExecutions Limit exceeded different errors

We have a batch that is running queueable inside batch execute. And we are testing this framework with volume data to know its limits. To give an example, if I test it using 1000 records with 1 scope ...
0
votes
1answer
26 views

help with writing a batch job on ContentDocumentLink? [closed]

However, I don't have any experience with writing batch classes and not sure what the syntax is, as i'm used to triggers. I was wondering if anyone could supply some good documentation, examples, ...
6
votes
1answer
54 views

How to get to the Id of batchableContext.getJobId() when handling a BatchApexErrorEvent?

I have a batch job that implements Database.RaisesPlatformEvents and when a BatchApexErrorEvent is generated from the Batch class's execute() method I handle it in a BatchApexErrorEventTrigger. I ...
0
votes
1answer
31 views

Execute List of batch strings

I have the following code that adds the execute batch into a list. List<String> batches = new List<String>(); batches.add(Database.executeBatch(batch1, batchSize)); What I want ...
2
votes
1answer
32 views

Understanding Batch Apex execution

This is a generic question which I couldn't find enough data online. I have a batch job that runs once every week. This job updates Contact records based on updates on the parent Account. Scenario: ...
0
votes
1answer
19 views

Insert multiple records using salesforce batch apex - DML Error

I am getting a DML error in the execute part of the Batch Apex - need a workaround, please Query: select Id,Name from Account Execute: for (Account a: acclist){ -- need to insert 10 ...
0
votes
1answer
23 views

ERROR: must implement the method: System.Iterable<SObject> Database.Batchable<>.start(Database.BatchableContext)

global Class Batchsample implements Database.Batchable<Attendance__c>{ global Database.QueryLocator start(Database.BatchableContext BC){ String Query = 'select id,Login_Date_c,...
1
vote
1answer
23 views

Please clarify my below doubt on batch execution sequence

I have batch class, basically it will query on account records where Account_Status__c is empty(Account_Status__c='') then it will create contact for such accounts then Account.Account_Status__c field ...
0
votes
1answer
18 views

Batch Apex Class is being weird

Here are the errors I am getting https://prnt.sc/ter539 I have no clue what I am doing wrong as I am following the documentation Salesforce is giving me for Batch Jobs... Here is my code. global class ...
0
votes
0answers
31 views

How to display continuation of task records sent from SingleEmailMessage using apex html

How to display continuation of task records sent from SingleemailMessage using apex html. I have sent email with task records using batch in html table, need to send 50 tas records per email but need ...
0
votes
2answers
28 views

REST API for updating 10k Records at once

I have a business requirement to update 10,000 - 15,000 records at once every Monday. I am using the REST API to update Accounts. My question is if I can call the API using Batches instead of calling ...
0
votes
1answer
30 views

List index out of bounds: 0 in execution batch - Send email

I am trying to understand what may be going on. My code basically sends emails through a batch. However, in the executions it is giving the error "List index out of bounds: 0". I can't find ...
0
votes
2answers
42 views

CRON Expression for specific time [closed]

How to schedule batch class to run at specific time 12.30 AM CST Daily. How to make it run at CST Timezone.
0
votes
1answer
66 views

How to display Batch Record Process Count on Progress Bar Indicator in LWC?

I am currently working on functionality where I am assigning Bulk Records Ownership to new user. For this, I have designed LWC and which calls helper class. and the helper class call a batch class to ...
0
votes
1answer
14 views

If account has more than 2 contacts then change email in contact field as default email using batch apex

am new of this salesforce here my code is: Thanks: public class Example1 implements database.Batchable<sObject>{ //Map<id,contact>IdContactMapBatch =New Map<id,contact>(); ...
1
vote
1answer
26 views

DML in loop in a batch process

I was working on something entirely different, wrote a test code and found a gap in my knowledge. Hoping someone can point out where and why my understanding is wrong. I have a batch job, it queries ...
0
votes
0answers
36 views

Not able to execute batch class

Please find my class and start code global class EncoreBatch implements Database.Batchable<sObject>,Schedulable, Database.Stateful, Database.AllowsCallouts { global List<String> ...
1
vote
1answer
26 views

Invalid field from Lead using sobject.put in batch apex

During a batch apex class, we are copying one field value from one field to another field. Using the following code below we got the error message. How can we resolve this issue? Steps we have tried ...
0
votes
2answers
75 views

Batch Apex vs Queueable

Thanks to another user (sfdcfox) I've got the following queueable apex being invoked via a screen flow that's being used to update account records. It's taking two string variables from the flow and ...
0
votes
1answer
60 views

query locator with string query or sobject list

Using the Database.QueryLocator object bypasses the governor limit for the total number of records retrieved by SOQL queries. One could implement one of the following methods to get the QueryLocator: ...
0
votes
2answers
33 views

“Too many SOQL queries: 201” while running batch - how to fix this code?

I want to test my method and I have this error: FATAL_ERROR|System.LimitException: Too many SOQL queries: 201 Class.PatchPanelTriggerClass.deleteDuplicates: line 202, column 1 Class....
0
votes
0answers
9 views

Why in this code these variables aren't changed in batch? [duplicate]

Variable flagForTest is false and variable count is 10 but they should be: true and 100. Debugs in batch show correct values, debugs in test class or invoked in Anonymous Apex show incorrect values. ...
0
votes
1answer
16 views

How can I make sure that block of code in unit test will be runned after batch ends - not before or during test?

I need to run batch (or something else which will process big amount of records) and after this branch I need to invoke System.assert(booleanVariable); How can I do this? Batch need to execute and ...
-2
votes
2answers
41 views

How could I implement batch functionality in Salesforce without built-in Database.batchable interface? [closed]

what the code would look like if I wanted to implement batch functionality without implementing built-in Apex interface?
0
votes
1answer
29 views

What could be the reason of not showing debugs in logs?

In batches I can't see debugs in logs and variables aren't changed inside batches but batches run and IDE shows 'Success'. What may be the reason of that? I checked in my organization and for 3 ...
0
votes
1answer
40 views

Why execute method doesn't run in batch in this code?

I should see this debug: "Batch starts" but this debug does not exist. Variables didn't change too. What should I do so that I could see debugs and modify variables in the execute method? I ...
0
votes
0answers
20 views

Test class for batch apex with if else statements [duplicate]

I'm stuck with test class for batch apex, please help me with this. BatchApex global with sharing class batchHandler implements Database.Batchable<SObject> { global Database.QueryLocator ...
1
vote
0answers
42 views

Still hitting SOQL limits in Batchable Context - how should I rewrite this?

I am new to the Salesforce platform so this is the first time I've had to proactively deal with governor limits and in particular try to make use of Database.Batchable context. Despite reading the ...
0
votes
0answers
8 views

EmailMessaging wont display the merge fields during the batchprocess

We have created a batchclass to send pending opportunity approval remainder email for the approvers as the flow we are sending email and referred a email template ID in which I have used merge fields ...
0
votes
0answers
24 views

Loop Variable Accessibility Issue

I have a unit test with this context data: List<Contact> testCon = new List<Contact>(); testCon.add(new Contact(AccountId = '0014000000zoemWAAQ', LastName ='Accounts Payable', ...
0
votes
0answers
29 views

Need help getting Batch Apex to work

I am a long time Salesforce admin/developer but I am still getting started with actually writing Apex code so this is probably a simple error on my part. I am trying to use batch apex to call the ...
0
votes
1answer
34 views

Scheduling apex batch jobs - what happens if frequency is too small for a large job?

I have a batch job that processes quite large amounts of data, in edge cases it can take up to 40 minutes to execute. I would like to have it run as often as possible. I have no way of estimating for ...
0
votes
1answer
43 views

Loop Element not reaching If Condition

Really two different things here. What this is doing is comparing the Email addresses of an external platform (Zuora Billing platform) to email addresses and accounts that already exist within SFDC. ...
0
votes
1answer
22 views

How to get the ID for the records which have not been modified in last 30 days?

I'm trying to delete the records of a particular object which have not been modified in last 30 days. For this I have my batch Apex set up but just not been able to build the query. Query written so ...
0
votes
0answers
20 views

Don't know how to execute an Apex Batch in a certain way

ExecuteToolingByOrgsBatch etbob = new ExecuteToolingByOrgsBatch(); etbob.Ids = new List<decimal>{304066}; etbob.code = 'I have code here'; Database.ExecuteBatch(etbob); I have a list of Ids,...
0
votes
1answer
19 views

Constructor not defined error when executing batch apex

Ive been working on this class to update a field on a related record with a field (zone) on the account record. When I try to test using "Id batchJobId = Database.executeBatch(new ...
0
votes
2answers
32 views

Deleting Records with Batch class and Platform Events

I am trying to delete accounts using a batch class. I am firing platform events from the batch class, and handling the deletion logic platform event subscribed trigger, but not all account records are ...
-2
votes
1answer
34 views

Help to write unit tests for batch job [duplicate]

I have a batch job that delete records from object that were created more than 13 month ago. Please help me to write unit test for this batch. Thanks @IsTest private class ...

1
2 3 4 5
33