Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
18 views

Scheduling a Batch Job dynamically?

I have a batch job which I want to be schedule dynamically according to a sunset time api ( which means that the sunset time is different each day). How can I do so?
1
vote
1answer
18 views

Test error condition in finish() method of Batchable class

Trying to figure out how to test error condition in the finish() method of this Batchable class. I am testing the error condition in the execute() method by calling it separately in the test and ...
0
votes
1answer
21 views

How to have a batch call itself to rerun, but wait 60 seconds before calling itself?

I currently have a batch which calls itself if it finds records still falling into scope. I am using a static boolean variable to do this. Now i have found out our email system cannot handle thousands ...
0
votes
1answer
16 views

Email updates based on it's value

During email update batch, (10k+ batch size) it failed, and half emails got updated and half not. is there anyway i can resume process in terms of update emails which not got updated? Here is code ...
0
votes
0answers
25 views

Create Excel XLS from batch apex via Visualforce page

I have a scheduled batch apex that currently creates a .CSV document and attaches it to an email, but I have to change it, so instead of a .CSV file, I get a formatted XLS Excel document. Now, after ...
0
votes
3answers
36 views

How to Get the error details from batch,

this is my apex batch finish method, how to get exact like attempt to de-reference null,invalid Id. with particular line number in the batch when it throws an error.. i am getting an error says null ...
0
votes
1answer
21 views

Updating parent record via Batch Apex

I am developing a batch Apex process to assign an 'engagement score' to Account based on event/ campaign attendance. We use Campaigns to track events and event guests. What I would like this batch ...
0
votes
2answers
28 views

Update existing records with before trigger [on hold]

I need to update the fields of a few records (around 20) that were existing before I made a trigger. I know that before triggers cannot update existing records (or can they ?) but I think that using ...
-1
votes
3answers
54 views

Too Many query rows in apex class

while running apex class in salesforce,I am getting too many query rows error staging list: String query = 'SELECT Id, Name,ECC_Line_Item_Number__c,Delivery_Number__c,ERPId__c, Customer_PO__c,...
0
votes
2answers
34 views

Assign random unique numbers to thousands of records

We have a custom object that once it's saved with a checkbox == true, it has to assign a unique random number to each of its children Cases, but the assigned number can't be either zero nor greater ...
0
votes
1answer
16 views

First error: You have reached the Connect API's hourly request limit for this user and application. Please try again later

I am doing chatter feed post using Batch class. And I am uploading 1000+ records, and for all the records the chatter feed post is happening. At the end of a batch, I am getting First error: You ...
0
votes
2answers
24 views

How to get most latest modified child record for a parent record in Apex Class?

I am trying to latest child record from a few child records under a parent. Below is how it looks in my code, set<id> caseSMSId = new set<case>(); caseSmsId = [case1.id, case2.id, case3....
1
vote
1answer
25 views

Apex Batch Jobs stop executing unexpectedly

Hi so we have a couple of Apex batch jobs that run continuously in our org. One runs every five minutes and one runs every fifteen minutes. In the batch's finish methods, the two reschedule ...
2
votes
1answer
41 views

System.UnexpectedException: Error processing messages in Test Class for Batch Apex

Error Message System.UnexpectedException: Error processing messages Stack Trace Class.System.Test.stopTest: line 24, column 1 Class.payout.BIgObj_Test.MyMethod: line 31, column 1 Batch Class ...
0
votes
1answer
19 views

Compare Lead Statecode field to Custom setting Statecode and update a field on Lead with the Region

I have a custom setting name "StateAbbreviationsInfo" which has fields of Statecode__c and Region__C. The requirement is to create a batch class and check for the lead statecode and find the ...
0
votes
1answer
24 views

Batch Test class Constructor Not Defined problem [duplicate]

I have the following problem in a test class. Constructor not defined: [Soma_Dependentes_Update].<Constructor>() Test class of the batch process: @isTest public class ...
-3
votes
1answer
36 views

How to convert the apex class into batch apex class? [closed]

public class MonPipelineReport{ public static void Get_Officer() { Date startDate = Date.today().addMonths(-1); startDate = Date.newInstance(startDate.year(),startDate....
0
votes
1answer
12 views

get count on error records in batch class

I am running a batch class of size 10. Now i trying to get the count of error and success records. I am using database.stateful to maintain data between batches. Im increasing the counter in exceute ...
0
votes
1answer
28 views

Batch and Schedulable Help

I'm trying to create a batch class that updates a set of number fields based on a particular profile that edits them and a schedule class that updates those changes every night at midnight. So far ...
0
votes
1answer
42 views

In Visualforce how to display progress and errors of Asynchronously upserting the results of 999 queries? [closed]

In Visualforce I need to ASYNChronously do 999 (n) multi-table queries and upsert all results (asynchronously, and presumably in chunks), to 1 custom_object__c, all from a visualforce page. The page ...
0
votes
1answer
29 views

Need help with Apex Batch job

I need to: Implement a batch job to Delete records that are past 60 days. Use helper class to implement the logic for deletion. Use the wrapper class in helper class to return the DML results to ...
0
votes
1answer
21 views

Apex Batch runs constructor but does not execute start method

I´m trying to run a Batch to delete some 'expired' Cases. In the test method when I execute the Batch the class constructor runs but the batch start method never runs. The batch class: global class ...
0
votes
0answers
11 views

Test Class for Batch Class which is getting called from Custom Iterable Class [duplicate]

Can someone help me out for writing test class for batch class which is getting called through custom iterable class Regards Pranav
0
votes
2answers
32 views

Process Instance object test coverage

Hi I have a batch that works on process instance object, i am struck how to achieve test class coverage for this as ElapsedTimeInHours is a system field and when i am creating approval instance and ...
0
votes
0answers
24 views

Database.update(lstOpportunity, false) in Batchable class execute() method

I have a class which implements Database.Batchable, Database.AllowsCallouts. In the execute method, when I am using just update lstOpportunity the update goes through but when I use Database.update(...
0
votes
1answer
37 views

Test Coverage for Individual Object

We may all know that Salesforce introduced the Individual object in 2018 because of the introduction of GDPR. Here what I need is I need to create a test class for the Individual object because I ...
0
votes
1answer
17 views

Why my private static Map is empty on execute when it is filled in the constructor in apex batch class?

In the following code: global class MyBatch implements Database.Batchable<sObject> { ... private static Map<String, Id> mailTemplates = new Map<String, Id>(); ...
0
votes
1answer
27 views

Help with batch/scheduled apex

I'm trying to figure out the best way to transfer Account ownership of certain accounts once a day. I would use declarative tools but can't because the data that would fire the automation is coming ...
3
votes
1answer
88 views

“SerialBatchApexRangeChunkHandler Internal Salesforce.com Error” from a batch execution

We are an ISV and we have a managed package. In the managed package we have an implementation of Database.Batchable that is also implementing Database.Stateful. It is global, so is part of our exposed ...
0
votes
1answer
24 views

Multiple updates to one record in one batch

I am updating the parent record of a record upon edit/save. However, if I update multiple records in that child object at the same time I get an error for excessive amount of updates to the same ...
1
vote
2answers
22 views

Batch Apex… which Object is iterable?

I'm dealing with the CampaignMember standard object, and a custom object called Binding__c. I need to create a new Binding__c record for each CampaignMember record, and there might be 25K of those -- ...
0
votes
2answers
23 views

Merge duplicates

In regards to @sfdcfox response to the solution on following thread Batch merging via Apex? Sorry to invoke this old post but I have a question about Merge_From__c lookup field on the custom object. ...
0
votes
1answer
42 views

Apex (hidden) - How to access the code?

I' like to access the code of an APEX Batch, but it's hidden ... I've already had this issue for a managed package, but this time I don't know where to look ! Any idea ? Edit :
-1
votes
1answer
21 views

In apex how to know the whether a batch is schedule or it's running?

I want to know the status of a batch like whether it is schedule or it's running
0
votes
1answer
28 views

Batch process throwing future method error

I have a scheduled job that executes a batch process that clones some opportunity records. When the records are inserted, it fires triggers on the opportunity that calls a future method, which throws ...
0
votes
1answer
20 views

how can I drop just the defect record and process rest of the records in a batch

I have a batch which reads data from another system and update salesforce records the reference used is SFDC ID, which is one of the parameter from the response used to identify the right record in ...
1
vote
2answers
33 views

Got error while constructing the dynamic query

I was trying to build a query to pass it in the QueryLocator. The following is the code snippet I tried to generate the dynamic query, public String buildQueryString(Object_Rule__mdt ObjectRule, ...
0
votes
1answer
16 views

How to update contact owner value

I have this SOQL: SELECT Id, mudouProprietario__c,(SELECT Id, AccountId, OwnerId FROM Contacts) FROM Account I need get value of owner account and set the value at the contact owner I created a ...
1
vote
1answer
46 views

How can we keep the global variable at Apex Batch

I have a use case to run sequence of Batch to execute my logic. There I need to have a way to start the Batch and terminate it, So for that I keep a global variable to store the records and according ...
0
votes
1answer
30 views

Batch Class execute using Cron job Schedulable

I am trying to run my Batch Class called UltimateParentAccount for every 6am and 12pm using a Cron Job Schedulable name ScheduleUltimeParentAccountBatch. I tested my batch class and it works well, ...
0
votes
1answer
47 views

Batch class to create a CSV file

first of all, thank you for your cooperation, right now I'm having problems changing my class to a batch class, the class that I will post below works, it creates a CSV file on "SageExtractFiles__c" ...
0
votes
2answers
42 views

Salesforce server IP which is making callout

I have a batch process which makes a HTTP call out to third party, but because of IP restriction third party is denaying the request. Is there any way to get Salesforce server Client IP from where ...
0
votes
0answers
66 views

WebSocket connection to '' failed: Error during WebSocket handshake: Unexpected response code: 405

I am trying to subscribe to platform events on VF page. But getting WebSocket connection error. Not sure what am I doing wrong. <apex:includeScript value="{!URLFOR($Resource.cometd, '/newCometd/...
1
vote
1answer
19 views

Command pattern with batch finish method

To chain a execution of a batchable object, I pass the batchable contructor a ICommand. public interface ICommand { void Execute(); } When testing this approach I create a test ICommand which ...
1
vote
2answers
46 views

Make http callout in batch after insert actions

I have a batch job with http callout enabled, in the execute() method, the code logic goes like: global void execute(Database.BatchableContext BC, List<Object> scope){ List<CustomObject&...
0
votes
0answers
18 views

Test execution causing Eventbrite error in 'Eventbrite OpportunityTrigger'

Facing issue in my batch test class. I am inserting simple Account and Opportunity in my test class. If we set(seealldata = false) the class fails in the sandbox and getting below error System....
0
votes
0answers
24 views

How to get complete error message from AsyncApexJob records?

I have a batch class in my managed package. One of the batches is failing the execution in Subscriber org. When I query the AsyncApexJob record related to that batch class I get the incomplete error ...
1
vote
2answers
133 views

Error encountered with usage of != or <> operating for SOQL query in batch class

I get the following error in Developer Console (logs) while executing this batch class with the following code snippet. 20:07:09:029 FATAL_ERROR System.QueryException: expecting a colon, found '(' ...
1
vote
1answer
19 views

How can I tell what the 'Maximum number of batch apex jobs queued or active concurrently' limit is in our org?

Is there a way I can tell what the 'Maximum number of batch apex jobs queued or active concurrently' limit is in our org? Usually it is 5 (Refer to Page 3 in this document), but I believe our org has ...
2
votes
2answers
99 views

How do static and member variables behave in a. stateful batch classes?

Suppose I have a batch job and I want to maintain state (i.e. want to keep a log of the record ids that I've processed, or keep a running total, or something). When would I use class variables vs. ...