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
3answers
37 views

Constructor not defined on Global Batch Class

I am receiving the following error. Constructor not defined: [DynamicBatchApex].(String, String, Map, String) (Line: 9, Column: 30) If you look at my DynamicBatchApex class, I clearly have the ...
3
votes
1answer
31 views

Testing BatchApexErrorEvent trigger

I have a batch class which implements the Database.RaisesPlatformEvents interface. This interface has recently been introduced and helps log unexpected exceptions: https://developer.salesforce.com/...
-1
votes
0answers
26 views

Use Batch Apex for a Visual Force page

I am a newbie to Batch Apex so hope someone can help me out. My main aim is to search through all my contacts and return all those which are duplicates on a Visual Force page, and then a button will ...
0
votes
1answer
28 views

Export data from batch to csv file

I want to create a quick action button that call to apex class that execute a batch(I used a batch because I want to retrieve More than 50000 records and I have salesforce limitation). I want to take ...
-1
votes
0answers
28 views

Queable to be called from batch/future

I have a method which updates all accounts associated with an agreement (currently almost 2500+ accounts) and then sends these accounts to external service for syncing i.e. updating them. Now the ...
-2
votes
0answers
38 views

Batch Apex crossing heap size and gov limit

I have written batch class its basically part of other batch class, it taking all contact and account information form campaign member and campaign account member (Custom Object relationship with the ...
0
votes
1answer
62 views

Conflicting triggers

I'm still new to Salesforce and still can't grasp regarding triggers. Scenario: My company's salesforce workspace has a managed package app installed. The managed package app has a custom trigger for ...
3
votes
3answers
96 views

Make a class to batch an existing class?

Not sure if this is possible. I've got a data factory class for my sandbox. If I run all the methods (I do it in Execute Anonymous) on that class then I end up with data I (reasonably) want in my ...
0
votes
1answer
51 views

Batch Apex System.LimitException: Too many query locator rows: 50000001

There is a object(assume A) which will store event logs for a custom object(assume B). A batch job, runs weekly on object A to delete the records based on some conditions. It throws an exception like ...
1
vote
1answer
79 views

Batch Apex: Too many SOQL queries: 201

I have created a batch apex and I get this error: Batch Apex: Too many SOQL queries: 201 while I don't have any SOQL query in a for loop. I suspect it is coming from the DatedConversionRate query but ...
0
votes
2answers
24 views

Apex Batch Coding Practices

While executing Apex Batch I might need the same Custom Settings / Metadata Values So which is the best practice Getting the data each time the execute method executes (Number of times depends on ...
0
votes
0answers
20 views

Only deliver batch error emails to one admin

I'm debugging a batch in our sandbox, and it's blasting all of the Admin users with an error email for each chunk: Database.executeBatch cannot be called from a batch start, batch execute, or ...
3
votes
0answers
21 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 ...
-3
votes
0answers
29 views

need a batch class to process opportunty and show the number of fields that are empty [on hold]

Global class BatchClass implements database.Batchable<sObject> { Global final string s_object; Global final string Field; global BatchClass(string s,string f){ s_object=s; ...
1
vote
0answers
29 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
52 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
24 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
28 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
40 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
64 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
34 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
46 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
11 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
22 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
49 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<sObject>{ Public List<...
0
votes
1answer
43 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. ...
1
vote
1answer
26 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
19 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
33 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
28 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
57 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
30 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
18 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
29 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
17 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
30 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
42 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
20 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
33 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
26 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
19 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
55 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
81 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
42 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
33 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
62 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
44 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
37 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
43 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 ...