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
3
votes
0answers
61 views

Why does BatchableContext.getChildJobId() return null inside Database.Batchable.execute()?

Per the docs, BatchableContext.getChildJobId() should return the id of the current batch chunk; when running in Database.Batchable.execute() I would expect that to always be populated. I'm using it ...
1
vote
0answers
123 views

How to bulk query ContentDocumentLink for Scheduled Job

I have a trigger that fires on the ContentDocumentLink object that then calls a REST Webservice. The logic basically places a users document into our Document Management System from Salesforce and ...
-2
votes
1answer
184 views

Query more than 50000 records in a normal class

I need to query more than 50000 records and store it in a List variable. i know there is a governor limit which prevents it. please let me know if this can be accomplished without going for a batch ...
0
votes
0answers
26 views

Salesforce documentation, how to write a test class for below code [duplicate]

I am trying to make a simple test class to get the code coverage. This is the class of the documentation in Salesforce which must be tested. Has anyone a sample for me :) ? Best regards. Constantin ...
1
vote
0answers
126 views

Database.querylocater on external object in batch class not returning any rows

I am writing a batch class on external object. Here I am using database.getQuerylocator in start method as the result will contain more thank 50k records. Batch class code: global class <...
0
votes
1answer
185 views

how to Find out who deleted a record in Salesforce

We have ServiceMax managed package custom object in our org. We have found thousands of records have been deleted and they were available in recycle bin. We are able see user id of deleted records. ...
5
votes
2answers
97 views

How to disable asynchronous jobs so that they cannot update data

There will be a data export happening from our org for large number of objects and records using a cloud based ETL tool. We have a business scenario where we need to make sure that there is no data ...
0
votes
1answer
84 views

Passing comma separated parameters o a batch apex

Currently I am passing one parameter into batch apex and querying the results. But, now i need to pass comma separated parameters and then i need to query records from all these passed parameters. ...
0
votes
1answer
111 views

System.QueryException: Inline query has too many rows for direct assignment, use FOR loop [duplicate]

I have a batch executed : 1 out 4200 is failing with : inline query has too many rows for direct assignment,use FOR loop My code in the exec function: List<String> personAccountsIDs = ...
0
votes
0answers
20 views

apex code download from FTP server [duplicate]

We need to develop a batch which will download apex code from a FTP Is it possible to do that with Apex or an AppExchange please? I search but no useful response..
0
votes
1answer
236 views

How to update a value in finish method of Database.Batchable

I am implementing a callout in Database.batchable public with sharing class BatchDocusignStatus implements Database.Batchable<SObject>, Database.AllowsCallouts { public Temp_REST_Auth__c ...
-3
votes
2answers
126 views

Getting Batchable size is too big error

Here my heap size is exceeded. Heap size is 20182515 enforced is 6000000 global class CloneRAEDBatch implements Database.Batchable{ Public List<Nike_Account_Team_Assignment_Rule_Stage__c> ...
0
votes
1answer
107 views

Test class for a scheduled batch is not firing the batch

I have tried the class in a sandbox and works fine (i.e. it updates all of the accounts based on the attached event records). The test class refuses to fire the batch class and I get 0% coverage. ...
-2
votes
1answer
31 views
1
vote
1answer
29 views

Real time synch with external application on insert and update of frequently changing records

In order to synch very large amount of frequently changing data to an external system, what will be best way to do it ? We can't use trigger or schedule batches as these will fire so many times that ...
3
votes
0answers
75 views

AsyncApexJob: TotalJobItems != JobItemsProcessed + NumberOfErrors

I'm running into an odd issue where AsyncApexJobs (from Batch Apex) are finishing with a status of "Complete" but the TotalJobItems != JobItemsProcessed + NumberOfErrors. Should I be concerned that ...
0
votes
1answer
132 views

How to execute Batch Apex form Visualforce Page?

I have three batch classes, I want to execute all three batch classes through button click using visualforce page at the same time. `LoanofficerBatch lob = new LoanofficerBatch(); ...
0
votes
1answer
32 views

Error in Upsert via Dataloader Batch

attempting to run the bat displays this error C:\Users\admsp-kelly\dataloader\v45.0.0\bin>process.bat "C:\BatchsPF\Protocolos\ conf" accountUpdate 2019-04-05 16:42:23,518 INFO [main] controller....
0
votes
2answers
394 views

Running Batch in Execute Anonymous but throwing error: method does not exist or incorrect signature void format string from the type anon

I need to run a scheduled batch out of schedule. It has been working every day perfectly for months. I went to try to run it in Execute Anonymous but I get the error: Method does not exist or ...
1
vote
1answer
160 views

How to combine multiple batches doing same operation on different objects into Single Batch?

Every Month, we have to reset a flag(of type boolean) on Custom Objects A,B and C. For this, I have written one batch class per object. ObjAResetBatch.cls public class ObjAResetBatch implements ...
0
votes
1answer
79 views

Find job status using the id returned from Database.executeBatch?

I have a class that is Database.Batchable which I execute via Database.executeBatch. How do I find the job status Id using the id returned from Database.executeBatch? It doesn't seem to match the Id I ...
0
votes
1answer
202 views

Any real time scenario when we will need to call future method from batch class? [closed]

I am trying to understand if there is any real time scenario when we will need to call future method from batch class ? Can anyone please help me ? Thanks
0
votes
0answers
141 views

One time Script in batches - Developer Console [duplicate]

I wrote a script to update a field value on several thousand records based on certain criteria. I will only be doing this one time, and that's the reason for not putting the logic in an Apex Class. ...
0
votes
1answer
38 views

First error: You have uncommitted work pending. Please commit or rollback before calling out [duplicate]

I am getting this error while running the batch. Any way to fix this. thanks global class FileImpoLog implements Database.Batchable<sobject> { global Database.QueryLocator start(...
0
votes
2answers
77 views

Fields Calculations in Batch Apex

I have an Object called Customer which has related object Purchase. Every Purchase has Account owner. Under one Customer there can be many purchase from different Account. From each purchase I need to ...
0
votes
0answers
37 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
157 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
34 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
21 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
322 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
1answer
311 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
80 views

Update existing records with before trigger [closed]

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
76 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
3answers
57 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
2answers
442 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
250 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
377 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
20 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
232 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
50 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
97 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
89 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
56 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
59 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
471 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
14 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
147 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
28 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
59 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
27 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>(); ...

1 3 4 5 6 7 30