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 vote
0 answers
28 views

Mysterious "System.QueryException: Truncated" error being thrown in batch job

I am an ISV provider and our managed package is experiencing this error in a batch job in a subscriber org. I cannot find any information on what it means. Oddly, debug logs on this error do not yield ...
user avatar
0 votes
0 answers
19 views

Unable to Run Batch Test Classes. Please help me [duplicate]

I have written Batch Class which is working fine (batch class is written below), now I want to write its test class. The one I have written is not giving 100% code coverage (only 30% is covering), it'...
user avatar
0 votes
1 answer
15 views

Monitor Bulk Data Load Jobs Remain "In Progress" even when there are no more batches to complete for the job

As the title suggests, I am loading data into Salesforce via the Python Simple-Salesforce Library. For some reason, the jobs that are fully complete, are still showing up as "In Progress". I ...
user avatar
-1 votes
1 answer
22 views

Field does not change

We want to change Blocked__c=true , if Range of Opportunity__Details__c is greater than range__c of Opportunity. But the code does not succeed changing the value of Blocked__c. global class oppBatch ...
user avatar
3 votes
1 answer
309 views

How to approach a very complex Batch class?

I am struggling with finding a blueprint (or a solution) to a batch class that would be run every 1-2 days and recalculate a checkbox on Event records which were updated within the last 2 days. Any ...
user avatar
  • 33
1 vote
0 answers
19 views

BatchApexErrorEvent not logging error

I just created a simple batch that gives custom exception when specific condition are met. I am using BatchApexErrorEvent for logging the some random value in account object Phone field to verify how ...
user avatar
0 votes
1 answer
26 views

What are cons of running a batch a few times a day?

Running a batch is needed because people want to see results from the batch in the same day. Now our batch runs every night Are there any issues (for example performance issues) of running a batch ...
user avatar
-1 votes
0 answers
30 views

Test class for batch apex with crontrigger

So i have this Apex Class Apex public void execute(Database.BatchableContext bc, List<SObject> scope) { List<CronTrigger> triggers = (List<CronTrigger>) scope; for(...
user avatar
  • 1
-1 votes
2 answers
29 views

squery not fetching the values in the batch class [closed]

need some help for the batch class as i am not able to print the sQuery values in the batch class, not sure what is the correct way to do this one. kindly some one help me for the correct sQuery in ...
user avatar
  • 11
0 votes
1 answer
35 views

Prevent Duplicate records on object in salesforce during batch job and keep running

Ok the situation i have is I have a nightly batch job that reads all picklist items and then puts them into an object so we can offload them to a data warehouse If the item already exists (combo of ...
user avatar
  • 415
0 votes
2 answers
60 views

No more than one executeBatch can be called

I've writtem a test class for my batch class. I've followed everything that was described in this question. Still getting the same error. Can anyone help me to find the problem in my code? System....
user avatar
  • 17
0 votes
1 answer
30 views

429 status code if I make call outs in Batch execute

From a batch apex I am trying a make a call out in for loop as like below for(eBilling__c bill : lstBilling){ try { HttpRequest req = new HttpRequest(); ...
user avatar
  • 59
0 votes
0 answers
54 views

Error too many rows 50001 in a custom Rest API

I have a custom rest API that when is called from a third party system (this third party system calls me providing a country code like UK, DE, US... and some other parameters) I filter account object ...
user avatar
  • 1
0 votes
1 answer
38 views

Test coverage for finish method in Batch Apex with a chain class

I wrote a test class for a Batch Apex Class that has a chain of another class in the Finish method. I tried the following approach, but it still does not cover the lines in the Finish method. Is there ...
user avatar
  • 17
0 votes
0 answers
29 views

Best possible way or best practice to get the count of distinct records if more than 5 million records are there in Object

I have a custom object with master detail relationship to Account and lookup relationship to contact. what is the best possible way to get the count of distinct contact records grouped by account. I ...
user avatar
1 vote
0 answers
34 views

Scheduled Job Is Not Running

I have written a REST API request that passes the response body to a class to deserialize it into a wrapper class. That rapper class then passes a list of records into a batch class incrementally so ...
user avatar
  • 13
-1 votes
1 answer
36 views

Getting error(TestMethod do not support Web service callouts) test class is failing because of the existing trigger on Job__c which making callouts

Not able to cover only Email messaging part in Execute method in batch class coverage is 62% Any help will be aprreciated. Batch class- global class SendEmailJobsAlertBatch implements Database....
user avatar
-1 votes
1 answer
66 views

Compare 2 datetime in Apex batch class

I have below query where i need to compare datetime custom field with system.now. Currently my timezone is australia/sydney,which i need to consider, I tried many combinations but getting Invalid ...
user avatar
  • 1
1 vote
0 answers
39 views

Does each chunking of a batch goes through the same process of Queued, Processing and Completed states?

As per documentation : The maximum number of asynchronous Apex method executions (batch Apex, future methods, Queueable Apex, and scheduled Apex) per a 24-hour period For Batch Apex, method ...
user avatar
0 votes
1 answer
17 views

I am getting FATAL_ERROR System.QueryException: unexpected token: BM_DPM_Date__c

I am facing the following issue. I wrote this query for the start method of my batch class. global Date startDate; global Date endDate; global Date currentDate; global Database.QueryLocator start(...
user avatar
  • 17
-2 votes
1 answer
36 views

For the Apex jobs that failed to execute, what is/should be the next action we need to take in order to determine the job run time?

For the Apex jobs that failed to execute, what is/should be the next action we need to take in order to determine the job run time?
user avatar
3 votes
1 answer
49 views

How do I get SerialBatchApexRangeChunkHandler errors to display?

I made a program using batch, when i tried to update the value, status in batch is succesfully, but i got error message in SerialBatchApexRangeChunkHandler, like this: I tried to using this query to ...
user avatar
0 votes
1 answer
35 views

How to deploy a batch class through change sets without a test coverage for that class?

I want to deploy only one class (batch) from sandbox to production and that class have only 10% test coverage but overall code has 80% test coverage. Would it be possible to deploy that class by ...
user avatar
0 votes
1 answer
19 views

i want to use the function in different class for single record id the function is currently used for bulk records, the function execute!

global class iCRM_PopulateDeliveryDateOnOutletBatch implements Database.Batchable<SObject>, Database.Stateful, PSR_TerritoryManagementBatchJob{ ...
user avatar
1 vote
1 answer
68 views

Getting the last record processed in batch apex class

What is the best way to grab the last record processed in one batch? The last record needs to be marked so a new record-triggered flow can begin when the last record in one transaction ends. Thanks.
user avatar
  • 17
-4 votes
1 answer
45 views

Process records in batch with one record parent at time

I have a requirement to process all records of the same parent field in a row. Have you an idea how to do this? Exple : need to get all contacts, I want to do some modification and give a rank to ...
user avatar
  • 3
0 votes
0 answers
51 views

Batch Job to delete specific live agent's chat transcript after 100 days

There are 4 live agent chats enabled in our org. I have to create batch job, that deletes only our division's live chat transcript once it pasts 100 days. what would be the condition or criteria I can ...
user avatar
  • 13
0 votes
0 answers
76 views

Batch class finish method not executing on REQUEST_RUNNING_TOO_LONG error

I intended to send an email to the users when the batch class fails due to any reason. I had placed my logic in the finish method. However, my batch class is failing for the reason : [...
user avatar
-3 votes
2 answers
77 views

How to avoid hitting the limit of batch apex from trigger?

If multiple users trigger the same behavior then there can be more batch processes, that can hit the governor limit. Asynchronous process is needed because there are large number of child records to ...
user avatar
1 vote
0 answers
36 views

Create Batch Apex to update data with no duplicate phone and account

Iam still new at salesforce, I am creating a batch for the requirement in which if contact has duplicates based on account and mobile phone than field named Eksternal ID should not set the value. but ...
user avatar
0 votes
1 answer
32 views

How do I use batch apex if my method is creating over 40000 records

It's just a simple question I'm having(It might sound silly but I've no idea how do I insert 40000 records). I'm first creating 200 Accounts and also creating 200 child Opportunities for each Account. ...
user avatar
0 votes
0 answers
43 views

Time Limit Error on After Save Flow that sends out emails

I need to create a flow that sends out a specific email alert when the Email_to_Send field changes. Email_to_Send is a picklist that has 10 different values. Each value has an email alert associated ...
user avatar
10 votes
2 answers
226 views

Poll for long-running API responses - Solution patterns

Many REST APIs that people want to use from within Salesforce have asynchronous, long-running operation. For example An endpoint POST /api/resource to create a resource returning a handle Id to check ...
user avatar
2 votes
1 answer
88 views

How to know when the last batch job in parallel execution finishes?

I have an apex class that is executed in parallel by calling Database.executeBatch() in a loop, where each instance processes a chunk of a dataset. After all the jobs that were executed finish I need ...
user avatar
  • 2,584
0 votes
1 answer
32 views

executeBatchMethod() runs but fails to trigger start(...) method

I'm debugging a batch class which auto creates a transaction record (a custom SObject). The following is my executeBatchMethod() , @InvocableMethod(label='desc.' description='desc.') public static ...
user avatar
0 votes
1 answer
49 views

Batch class finish method email exceeded

I am trying to send the email with csv file attachment but it returns email limit is exceeded error, so I tried to send email using trigger there it work properly than why it is not working with batch ...
user avatar
1 vote
0 answers
26 views

Issue with Batch Job completing abruptly

I am trying to process 1000+ records from Custom metadata(CMDT) via a batch job. This is how my business logic runs : In my start method, I query all the records from CMDT ,In my execute method I ...
user avatar
3 votes
1 answer
49 views

Best architecture solution for Mixed DML Exceptions inside a Batch

I am writing an apex Batch First I am updating a few EmailTemapltes and then I need to write to a custom object. public void execute(Database.BatchableContext context, List<EmailTemplate> scope) ...
user avatar
  • 31
0 votes
1 answer
56 views

Batch Apex Class Send notification Test Showing only 29%

global class CertificationEmail implements Database.Batchable<sObject>{ global String soql=''; global Database.QueryLocator start(Database.BatchableContext bc) { Date d =...
user avatar
0 votes
1 answer
80 views

Why does my batch not kick off?

I have a trigger logic that runs when an Opportunity stage changes and updates/inserts/deletes a bunch of related records. For some Opportunities where there are 300+ OpportunityLineItems I get CPU ...
user avatar
  • 3,334
1 vote
1 answer
218 views

DML operation Delete not allowed on List<CUSTOM OBJECT>

I have a scheduled job named "Scheduled_Mail" and its class is "Scheduled_Mail_Controller". From February 13, suddenly the following error occurs. 'Scheduled_Mail' : Dependent ...
user avatar
  • 13
1 vote
0 answers
49 views

Iterable in apex batch start

Iterable had an upper limit of 10000 records in batch apex earlier, when used as return type for start method. However in docs, I cant seem to find it anymore. Is this limit removed or not relevant? ...
user avatar
  • 304
0 votes
0 answers
30 views

Batch Apex Help

I'm looking to create a batch class but I'm struggling with how to connect it. I need to go through and sum up the hours logged against an engagement. I need to compare that with the engagement split ...
user avatar
  • 1
0 votes
2 answers
116 views

How to make a date dynamic SOQL query for Database.getQueryLocator?

My goal for this class is to run for every missing day up until today, with just one call from an anon block. I would like some assistance with creating a dynamic soql query that will work within the ...
user avatar
  • 13
0 votes
1 answer
74 views

Dealing with Millions of records - Bulk API 2.0 or HEROKU integration

We have a Heroku Postgress setup which has contact object data of our sfdc org synching every 5 mins ( bidirectional ). I have a use case where I need to manipulate approx. 20 million contact recs. ...
user avatar
0 votes
0 answers
58 views

Batch job does not process all the records from Custom Metadata

We have a batch job that queries all the records from Custom metadata(CMDT) and processes them in executebatch() one by one and sends emails . return IRR_SEL_AutomatedMessagesSelector.newInstance()....
user avatar
0 votes
1 answer
64 views

How to build large single XML Document over multiple batches

I would like to understand if it's possible to generate large XML files using XmlNode and Document classes in Batch apex? Ideally, I would like the Dom.Document class variable to be stateful. However, ...
user avatar
  • 616
0 votes
1 answer
47 views

How to delete a child and a parent object in the same batch class?

I have a situation, where I need to delete both parent and child log files. I need a batch file, as the number of records is large, and the delete is on a weekly basis. OFC - I can write a second apex ...
user avatar
  • 5,435
0 votes
1 answer
49 views

CPU Timeout Limit reached

I know this is vague but to be honest I don't know what else to do other than ask here. We have various Apex classes which used to work without any problems but now frequently fail with a Limits CPU ...
user avatar
  • 611
-4 votes
1 answer
91 views

Batch Class to count the number of record with same Name [closed]

I need to write the batch class Where I need to store count of duplicate value of field Requirement - On Account Object there is one field called Parent_Name__c which is text Field its store the ...
user avatar

1
2 3 4 5
38