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.

learn more… | top users | synonyms (1)

0
votes
2answers
25 views

Batch Apex for Counting number of Contacts associated with Account

I am developing one Batch apex which will count number of Contacts associated with Account object.It will store the count in a field "No_of_Contacts" on Account. I am confuse in how can i write SOQL ...
-4
votes
1answer
25 views

Batch Apex Class Information

In our Sandbox Organization Apex Classes are written in year 2011. Please find below images and Apex Classes information and let me know about what is exactly they do in our organization with apex ...
1
vote
1answer
13 views

AsyncApexJob entry of type BatchApexWorker

I have batch apex that gets scheduled using system.schedulebatch call. What i see is when job is scheduled I see 2 entries on AsyncApexJob object. 1 record is of JobType BatchApex, 2nd record is of ...
1
vote
0answers
17 views

Batch Apex job not able to complete

I have a batch apex job that runs multiple times thru a day and night. Once it finishes, I am scheduling same job but after x mins. This job is not doing any heavy lifting. It is querying around 500 ...
0
votes
0answers
6 views

Submit or Abort Batch Apex using SOAP API

Is there a way to submit or abort batch apex job using SOAP API ? I don't see any SOAP API calls for this purpose but want to make sure. If there is no SOAP API call, can executeAnonymous() soap API ...
2
votes
3answers
62 views

delete records from multiple objects via apex batch class

I have a requirement for a process that would delete qualified records from multiple objects. There are about 5 objects and criteria for deletion is the same for all objects. I want to do all of it in ...
0
votes
1answer
35 views

Gettting the issue while running batch apex from apex class

I have developed one class which runs on REST webservice and called batch apex for more than 10000 records deletions for the same. Right now its showing error while fetching query by parameter. Could ...
1
vote
1answer
19 views

Calling executeBatch() method of two Batchable classes in execute method of a Schedule class

I was just wondering is it possible to class executeBatch method of two different Batchable classes inside the execute method of a Schedule class. For example; global class BatchClassA implements ...
-2
votes
0answers
13 views

Salesforce Async Callouts without Visualforce Page(Batch Apex) [closed]

By using continuation object we can make async callouts, but it should have visualforce page to work on it. Is there any way to make it from batch apex. Thanks in advance
0
votes
1answer
32 views

Modify batch class already in schedule

How can I modify a batch class that is already placed in a schedule. I have deleted the Scheduled job and still getting error to modify the corresponding batch class. Can someone please help me here? ...
1
vote
2answers
21 views

BatchApex - System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

I am making a callout and then trying to insert the data and then immediately I make another callout followed by insert operation. This process continues for users matching my criteria. How to avoid ...
0
votes
3answers
58 views

SOLVED - REST API composite batch fails - INVALID_BATCH_SIZE

I'm trying to use the new batch REST calls as documented here https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_composite_batch.htm#topic-title But I get the following; ...
3
votes
2answers
108 views

How to fill new custom field on already existing accounts?

I need experts advice on the situation we have. We are creating a new datawarehouse and copy all the already existing accounts from salesforce to our new datawarehouse. The other systems in the ...
3
votes
2answers
88 views

Testing batch class

I've a batch class in which I pass query as well as few parameters in its constuctor, like: bclass1 b1 = new bclass1(query1, 'x') ; bclass1 b2 = new bclass1(query2, 'y ') ; bclass1 b3 = new ...
1
vote
1answer
8 views

Batchsize and SendEmail Calls Per Transaction

I have a Batch method that selects all the Leads with a certain criteria, and attempts to convert them if certain details are met. When they're successfully converted, I want to send an e-mail ...
0
votes
0answers
11 views

Need to batch replace ~1200 records daily - suggested method?

What I need to replace is the last 6 months of related daily data Previously the batches were coming to me with a unique ID so I was able to run an upsert via Jitterbit overnight, but will not ...
0
votes
1answer
19 views

I have written a test class for Batch apex and could not find code coverage?

global class gz implements database.batchable<sobject>{ global database.querylocator start(database.batchablecontext bc) { string sn='closed won'; string query='select id,name,stagename from ...
1
vote
3answers
38 views

Before Insert or Upsert list must not have two identical equal elements

I am trying to populate a custom object(Account_Report__c) by a batch Apex that will fetch related records from two other objects (Account and Product_Metrics_vod__c). Account and Product Metrics ...
0
votes
0answers
31 views

Apex Batch Job and Update status of a field

I have requirement to update the status of the field to "Queued" as soon as it is picked up a batch job and after the job is completed then I need to set the status to "Processed". The reason is, I ...
2
votes
1answer
35 views

Apex Batches creating too many chunks

The following implementation results in 5 jobs on the Apex Jobs page. The scope size is 100, and the total record size is also 100, per start(), so I was expecting only 1 job. Batch Class private ...
0
votes
0answers
16 views

Is there a way to find records updated with IsBatch = TRUE

There was one issue which cause due to admin loading data with batch size more than the org's limit which is 50. The code was not written to handle a batch. How to identify what all records got ...
0
votes
4answers
58 views

Alternative to write SOQL out of FOR in Batch Apex

I have following trigger executing after record is inserted and calls a batch to process records. In this batch I have few IF conditions to update records. Due to business scenario I have to write ...
1
vote
0answers
29 views

Apex Scheduled Jobs Error

I am trying to scheduled a job but I get the following error: You have exceeded the maximum number (100) of Apex scheduled jobs. However when I checked my current scheduled jobs, I see only 2 jobs ...
3
votes
4answers
127 views

Batch Class : how to get Scope size informations at constructor level

This is a philosophical question (maybe not properly) ... I'm wondering about being able to have informations about the scope size for every batch chunk. OK, it's possibible to get the scope size() ...
0
votes
0answers
23 views

Schedule batch class on hourly basis

How can we schedule batch class on hourly basis? I wrote code getting error global class scheduledcontainSupportCode implements Schedulable { global void execute(SchedulableContext SC) { ...
1
vote
1answer
50 views

Class Must Implement the Global interface method: Iterable<SObject> start Database

Given the following code: global class MyBatch implements Database.Batchable<SObject> { global MyBatch() {} global void execute(Database.BatchableContext BC, List<MyBatch ...
1
vote
1answer
16 views

reassigning account executives - apex class

I am trying to reassign Account executives depending on the requested date of open cancellation opportunities. If the requested date is 90 days later than today, I want the open cancellation ...
4
votes
3answers
137 views

Error when executing batch apex from anonymous apex code

I need to do one time data update in the org. I plan to do this using batch apex. As this is one time update, I don't want to move batch class to production and don't want to write apex unit tests for ...
3
votes
0answers
39 views

Batch jobs sitting in “Holding” status after flex queue turned on

Since turning on the flex queue, I am seeing batch jobs that previously executed near-instantly now sitting in the "Holding" status for a very long time. It appears that only one job per hour (on the ...
0
votes
2answers
50 views

Before insert with million of records on custom object

Hi we have requirement where an external system will call Salesforce to insert millions of records in a custom object. External System will send contactAddress id in SOAP request. I need to make sure ...
2
votes
1answer
48 views

Batchable Class from a List, not from a query

Is it possible to run a batchable class from a List<sObject> that is passed into the constructor as opposed to generating a scope list from a query? For example, I have a list of ...
1
vote
0answers
50 views

INVALID_CROSS_REFERENCE_KEY, invalid cross reference id on Lead update

I am trying to run a batch apex to update a list of leads, i get this error 'INVALID_CROSS_REFERENCE_KEY, invalid cross reference id:' only for few of the apex jobs, the other jobs of the batch ...
1
vote
1answer
25 views

Is there a way I can record when the last time a piece of code was run?

I have written a Page and Controller which update a field in all Person Accounts in my org using a batch process. This is only meant to be done once a year. Is there a way I can record the last time ...
0
votes
2answers
80 views

help to get 17% to 100% for batch class

I am new in SFDC i need to get 100% code coverage for this batch class currently it has 17% and i am facing problem in every Messaging.SingleEmailMessage mail = new ...
3
votes
2answers
78 views

Writing Test Class for Apex Email Batch Job

I need help writing test cases for an email batch job. In the batch job, the users associated with the Franchisee__c field (a Lookup to User) from the custom object Store_App_Proc__c are selected and ...
0
votes
2answers
27 views

Rolls up the number of cases created within the last 30 days to the Account

Here's the requirement: Rolls up the number of cases created within the last 30 days to the Account. global class ZW_BatchCaseNumberRollup implements ...
3
votes
1answer
116 views

How can I send an email alert every day to 5000 contacts

We want to send an email to contacts every day. There will be say 5000 contacts. I can't do this with apex code because there is a limit of 500 emails per 24 hour period. So I will have to do this ...
0
votes
0answers
37 views

InstallHandler and Apex Batch

We are encountering a issue. From InstallHandler Apex class we are invoking a Apex batch class. The start and finish function have email methods. When we are executing the apex batch class from ...
2
votes
1answer
73 views

“Access to entity 'MatchingInformation' denied” on batch

I have a batch that's been running for years that started failing because of First error: Access to entity 'MatchingInformation' denied. I've searched around and can't find anything about this and I ...
0
votes
0answers
16 views

How to know which emails failed due to invalid email address in batch job?

I have wrriten a batch job that successfully sends data to the email addresses which are valid. But I am not able to get any information about the emails that are failed because of invalid email ...
2
votes
1answer
63 views

Bulk Import Leads From SQL Table and store leads id back into table

I need to bulk import leads from sql server table, get back the newly created leadid and store them back on sql table. I read documentation on salesforce bulk api. Salesforce returns a response with ...
0
votes
0answers
25 views

Continuous Webservice call from Developer sandbox to QA sandbox

We wanted to implement a functionality that would fetch data from QA to Developer sandbox for testing purpose. For this: I created a VF page that has only two fields, the first dropdown shows the ...
-1
votes
1answer
110 views

Constructor not defined error in batch class

I am testing the scheduled batch class in salesforce, during which i am getting the below error : " Error: Compile Error: Constructor not defined: [LicenseOptimizer_BatchClass].(String) at line ...
1
vote
2answers
198 views

Test class for batch is not covering the execute method

I have test class for a batch the test class is not covering the execute method of batch. Does anyone have any idea what is the reason for this. My batch class : global class ...
1
vote
0answers
34 views

how to Read and write salesforce data from Heroku for app

We are planning to create app, which will read data from salesforce, do processing and then write result back into salesforce. This operation will happen in 2 modes 1. Real time when user takes any ...
0
votes
3answers
75 views

How to Send a consolidated email for all batch class job finish at the end of the day

We have 2 batch classes which run once both related objects are updated. However, everytime they are updated and the corresponding batch jobs are finished we got email notification. How to limit this ...
3
votes
1answer
46 views

How can I create over 10,000 records with information from Visualforce?

I have an inventory input page that I am working on and I am running into an issue where I need to create more than 10k records. The problem here is that all the information needed is not stored in an ...
4
votes
3answers
198 views

Why does the value of Static variables in batch context reset for each transaction

As part of the batch context, the static variables get reset at each transaction irrespective of Stateful/Stateless. class batch_test implements database.batchable, database.stateful () { static ...
3
votes
2answers
120 views

Null pointer exception while handling DMLException

I have a batch job that tries to handle any DML exceptions and write them to a separate Custom object called Feed_Log__c. I have sometimes getting a Null pointer exception after trying to handle a ...
0
votes
2answers
49 views

How to detect the name or id of currently running batch job from trigger?

Managed code kicks off a batch job. I have a trigger where I need to do overwrite a field only when it's updated by this batch job. The only thing I could come up with so far is querying ...