Stack Exchange Network

Stack Exchange network consists of 174 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.

1
vote
1answer
7 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 ...
0
votes
0answers
17 views

After Processing 20 records in batch how to send an email [on hold]

Can anyone please help me, We have a batch class. Suppose we have a batch size of 20 i.e.we are running the batch for 20 records at a time. After processing of every 20 record I want to send an email ...
2
votes
2answers
61 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. ...
-2
votes
0answers
16 views

convert Bulk of Leads,ten thouand. one by one serially.my leads are in csv.any ..? [on hold]

global Database.QueryLocator start(Database.BatchableContext context) { return Database.getQueryLocator([SELECT Id,LastName,LastModifiedD__c FROM Lead ]); } global void execute(...
0
votes
1answer
23 views

Give customer keys with batch processing

I need to build a dynamic content with dynamic images with AMPScript. If I use ContentImageByKey(), I need to change the customer key of every picture individually and logically(for example, use the ...
0
votes
1answer
14 views

How is an individual batch called vs. the batch that it's part of?

So - I was always confused about the batch terminology. You can call Database.executeBatch to - you guessed it - execute a batch. But then again this "batch" also consists of a couple of batches. Does ...
0
votes
1answer
14 views

Custom iterable class Issue

I have written a batch class with Iterable interface  and the custom itrable is below. My question is i am comparing the value of i in the code to 8 if the records are more than 8 it throws CPU Time ...
1
vote
2answers
123 views

Error: Future method cannot be called

Getting the error below while introducing a new app. The new app is attempting to update all accounts and this is happening. Most likely because it is maxing out the callout limit. I can deactivate it ...
0
votes
0answers
42 views

map wrapper columns dynamically

Suppose, i have a wrapper class with 5 variables to fill. So just wondering can i create a list of all these values and while calling a wrapper, can i use the map to retrive variable names of wrapper ...
-1
votes
2answers
50 views

Iterable Batch Apex

I want to write a batch class and need to make a webservice callout from it. Once the response is returned in Json format. I want to process the same into objects of salesforce. So I know how to make ...
0
votes
1answer
17 views

Send An Account Email ID When Account does not have primary contact using Batch Apex

I Have Occure multiple error missing single ' quote on line number 20. But still i am confused would this batch apex eligible for sending emails to account owner. Global class Contact_CD implements ...
0
votes
0answers
13 views

Count the 5 queued or active batch jobs that is allowed for Apex

I am trying to update my code from sequence queueable to sequence batch. This is the link of the code I've tried to update Run Queueable as sequence, The problem I have at the moment is that this ...
0
votes
1answer
15 views

Setting global batch number

I have a process that from time to time sends me that fail message. "Maximum number of duplicate updates in one batch (12 allowed). Attempt to update Id more than once in this Api call" Is there a ...
0
votes
2answers
32 views

Dynamic Batch apex with sobject iteration

I have a batch apex which takes the record from source object (can vary like Opportunity, Opportunity line item etc) and paste the record into target object i.e Opportunity_Prod_Batch_Record__c (fixed)...
1
vote
1answer
66 views

How to process more than 10K records from batch in one Transaction?

we have a functionality as following: on VF page we define some criteria say e.g Account Name = Nachiket and some other configurations. configuration details we store in custom object say Custom ...
1
vote
1answer
55 views

Error: Future method cannot be called from a future or batch method

I have a managed packaged that I recently updated and it threw an error for a future method I have that sends information to a third party. The error I received was: Future method cannot be called ...
0
votes
1answer
42 views

Difference between Batch, Job and Transaction in Salesforce?

As a title, can anyone help me to distinguish what is the difference between Batch, Job and Transaction in Salesforce?
0
votes
1answer
58 views

Callout from scheduled Apex not supported: Retrieving token

I have a scheduled batch class that updates my order payments however I am receiving an error that the callout is not supported. I have read other posts that for batch classes if Database....
5
votes
2answers
182 views

Enforce Batches (whole run, not single jobs) to wait for each other

A few situations in my app trigger a Clean up batch to run. It will process many records. In some situations multiple of such Cleanup batches will be triggered by independent user operations. If the ...
0
votes
1answer
36 views

test class with Batch and Callout [duplicate]

I have a problem with FeedItems in my Test class, it's very weird behaviour Does someone explain to me why this happens? Callout Class public with sharing class Callout { public static void ...
0
votes
1answer
22 views

Batch Adding Compile Error

I'm trying to create a list from a custom object (InvoiceAccount) and with a key of AccountID, get all the related Contacts and insert fields from both of them into another Custom object (...
2
votes
1answer
39 views

Why Would Batchable Not Run the Specified Scope Limit?

I call to a batch class on 204 records: PaymentAgreementMonitor myBatchObject = new PaymentAgreementMonitor(); Id batchId = Database.executeBatch(myBatchObject, 66); When it runs, it is running on ...
1
vote
2answers
62 views

Query Limit on Batchable Class

What is the best practice with governor limits with Batchable classes and queries inside of the Batchable class? I am running into query limits with a Batchable class because I have too many ...
0
votes
3answers
40 views

Test Coverage in Select DML Exception

How can we throw DML exceptions in Batch Start method in apex? I want to cover a code using test class which handles dml exception in select query in batch start method. Query is simple select query ...
0
votes
1answer
21 views

Executing Function with Batch Execute Class

I am attempting to refresh an account list that I utilize within the execute function of a batch class. I am trying to do this by wrapping the query in a function. My purpose in doing this is so I do ...
0
votes
1answer
33 views

Delete last 30 days data using batch class not working

i have been trying to delete last 30 days records through batch class, i am not getting any errors. i don't see my records were not deleted while i run the batch job, please advice. thanks in advance.....
6
votes
2answers
192 views

Is this test for callout wrong? How to make a bulk?

I wrote mock and test for callout, but I don't think it's right. I think I check wrong things with asserts and maybe call the same methods a few times, while have another ways to get 100%. Have I? I ...
0
votes
1answer
34 views

Trying to get session id in a batch/queueable apex [duplicate]

I have tried both the below approaches, but still I see only "SESSION_ID_REMOVED" in the debug statements. When I schedule the batch from Developer console, I am getting the "SESSION_ID_REMOVED" in ...
1
vote
1answer
38 views

Duplicate batch is not working as the original one

I have created a chain of batch classes (5 batch classes calling each other) and everything working as expected. After this is deployed in production, to do a real time testing and debugging for ...
0
votes
1answer
44 views

Batch Apex ignores records even without subquery in start()

Basically the querylocator returns about 200000 records at the start, I can see it in logs, also there are not any errors or limits warnings. The size of each job matters because the smaller it is,...
1
vote
1answer
43 views

Batch Test Class works in Production, Fails in Test

I've started a new job and the test code coverage here is poor. I am working to improve this and one of the batch classes has coverage of 77% in production. This is now below the org % so I thought I'...
0
votes
1answer
30 views

Unable to get the non duplicate Contact Emails from Child records

I have a lookup relationship between Order Line and Contact Objects where Contact is the parent. I am writing a batch class which looks for certain criteria on Order Line and send email to Contacts ...
0
votes
1answer
19 views

Batchclass How to get start variable in execute method

I want to get the metaapi variable in the execute method. global static IntelligratedAPI__mdt metaapi = new IntelligratedAPI__mdt(); public String query; global Database.QueryLocator start(Database....
-2
votes
1answer
34 views

Cover execute method of a Batch class

first of all thank you for your time, i need some help to cover this batch class, right now the test class i will post bellow only covers the finish method and the get; set; . CLASS: global class ...
0
votes
1answer
40 views

Limits of Batch, REST API: how to get 2000+ records, not just 250?

This code works, but I can get only 250 records even if on other side 2000+ records. I think my batch is incorrect. How can I make a few callouts per 1 time to get 2000+ records from service side? ...
0
votes
2answers
28 views

What's wrong with my Batch Apex + Http callout get method?

I think my code is wrong. Last version of my HttpGet/Callout code (it works): How to use HttpGet service to get a list of objects and create them? Now I try to make it batch. My Execute Anonymous ...
0
votes
1answer
23 views

Batch Scheduler Error

I have Created a batch scheduler which need to run for Every 5 min. but i am getting this error. can any one please help me out. Error: Compile Error: Method does not exist or incorrect signature: ...
-1
votes
0answers
55 views

Batch APEX CSV Reader

I'm trying to implement a batch process that will read a fairly large csv, and import the files into the Account Object. To do this, I'm referencing https://developer.financialforce.com/...
1
vote
1answer
227 views

First error: Query of LOB fields caused heap usage to exceed limit

I simply try to execute a batch job and execute a SOQL inside the execute() method as below with having, execute() method has the line List results = (List)database.query(query); , and start() ...
0
votes
1answer
31 views

how to write 2 queries in the start method of batch class based on condition

how to write 2 queries in the start method of batch class based on the condition select id,name,email from Account where createddate=today select accountid,Account.name from Contact where account....
1
vote
2answers
48 views

Batch Apex updating 300,000 records and returning errors in CSV and sending as Email

I have to update 300,000 records using Apex Batch. I also have to send an email to the user with the CSV file containing errors from update operation.Assuming all 300,000 records give failure, if I ...
1
vote
0answers
21 views

how to check iterator in batch process

I am using an iterator to use an aggregate query on a custom object looking for unique years. on the very last iteration, I want to change a value, so I am hoping to use hasNext, but it looks like i ...
0
votes
1answer
31 views

Optimal number of records per batch

I have a problem executing a batch in some limit cases that i want to cover to avoid future concerns. The scenario is the following: My batch works on n(reasonable high number) records of the same ...
0
votes
1answer
22 views

Apex Batch Test Class Does not seem to be executing the Execute Statement

Based on the posts I read it seems like the consensus is the test record is not being created but I believe it has enough to create. The execute part of the class never seems to fire. The actual ...
1
vote
1answer
33 views

AsyncApexJob record when I use System.scheduleBatch() method

I have just found a very strange behavior regarding Batch. If I have a Batch and run it using the method Database.executeBatch(), a new record inside AsyncApexJob table is created and I can use ...
1
vote
1answer
35 views

Insufficient Code Coverage for Batch Class

global class EmailNotificationBatch implements Database.batchable<sObject>,Schedulable,Database.Stateful { /* Getting data from the account */ global Database.QueryLocator start(...
1
vote
1answer
18 views

Issue with batch which is scheduled for every 5 minutes and didn't run for 24 hours and 5 minutes

we have batch which is scheduled to run every 5 minutes. This batch was working well for few months and then on 7th of November it didn't run for 24 hours and 5 minutes. After that, it is running ...
0
votes
1answer
36 views

Can we schedule a apex class at a time in different time zones

We have a batch class to updates events dates. But all the users are not in same time zone.Some users are in Uk,Some are in USA,Some are in India..etc My batch class will run every day at 1 am of ...
0
votes
2answers
35 views

Testing Outbound Messages via Apex

I'm trying to write a unit test to check whether or not an outbound message was triggered via a workflow. For instance, I have a class that will set a field on a contact record. The workflow rule is ...
0
votes
2answers
29 views

Batch Apex Limits in a trigger

In the trailhead lesson "Use Batch Apex" the final line states: Use extreme care if you are planning to invoke a batch job from a trigger. You must be able to guarantee that the trigger won't add ...