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
-1
votes
1answer
42 views

“Variable does not exist” error in catch block even when the variable is outside the try block

I have written a batch class and using try-catch in its execute method. But on saving the class, getting variable does not exist error. Sample code is given below: global void execute(Database....
0
votes
2answers
50 views

Apex Batch Job Start Method

I need to set up a daily batch job that makes an REST API call to an external service and updates contact records in salesforce. The data in the external service changes once daily. The external ...
0
votes
3answers
199 views

Constructor not defined: .<Constructor>()

can anyone please help with how to resolve this error? I am getting this error Constructor not defined: [GA_AP_CreatePartnerUsers].<Constructor>() at GA_AP_CreatePartnerUsers CreatePartnerUsers ...
0
votes
0answers
33 views

The execute method in my apex batch job is not being covered [duplicate]

Batch job class: public class Renewal_job implements Database.Batchable<SObject> { //public Renewal_job() { //} public Database.QueryLocator start(Database.BatchableContext bc){ ...
0
votes
2answers
37 views

Design to run a batchable after a trigger and account for multiple workflows

Our current design starts from a trigger, checks the data against a bunch of rules that the customer sets up. The ones that pass get sent to another job which exports it to another external system ...
0
votes
0answers
44 views

Batch Apex Too many SOQL Queries: 201 on a relationship query

REQUIREMENT Create a batch apex class that needs to update all of the accounts based on the number of contracts and opportunities for that certain account. Here is what I have so far. However, I am ...
0
votes
1answer
62 views

Test Class for batch apex - Getting Error

I'm looking to see if anyone could provide any pointers on the test class I'm trying to write for the following batch class: public with sharing class TerritoryReassignmentAccounts implements Database....
0
votes
1answer
75 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
32 views

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

I am using a batch class where data iterated over an object Now i am trying to retrieve some fields iterating over object1 Issue - its giving me common id for provider Base value
2
votes
1answer
52 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 ...
1
vote
1answer
33 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
64 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
28 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
58 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
56 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
45 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
32 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
153 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
33 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
102 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
36 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
42 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
38 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
28 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
25 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
34 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
42 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
129 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
352 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
15 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
31 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 ...
1
vote
1answer
29 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
212 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
271 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
39 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
10 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
17 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
31 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
81 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
12 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
25 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
38 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
91 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
45 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. ...

1
2
3 4 5
33