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)

1
vote
0answers
18 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 ...
1
vote
3answers
46 views
+50

Batch size informations at constructor level

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() within an execute call of the batch, but what if I'd like ...
0
votes
0answers
15 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
21 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
14 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
47 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
24 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
39 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
44 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
33 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
votes
0answers
36 views

Trigger Calling a Batch Class to Perform Mutiple Object Updates

I have Scenario like this there will be a config object(custom object) holding the records of schema selected object names and fields names from salesforce UI and a flag values. once the user has ...
1
vote
1answer
23 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
75 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
53 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
24 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
0answers
75 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
24 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
67 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
14 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
0answers
30 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
19 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 ...
0
votes
0answers
60 views

Bulk API : Querying multiple objects in parallel

I am working on retrieving all the records for a few set of objects such as Accounts, Contacts, Account Partner, and a few custom objects, etc. I have obtained all the fields through the describe() ...
-1
votes
1answer
73 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
110 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
25 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
38 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
37 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
120 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
90 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
35 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 ...
0
votes
0answers
23 views

Batch class for merge lead

How to write a batch class for merging the leads? Based on the two fields i have to merge, once merge done i have to update the owner,status fields. suppose we have 3 status fileds are good at that ...
6
votes
0answers
66 views

When are the Queueable/Batchable penalties going to be enforced?

According to The New Apex Queueable Interface, from October 2014, we were told that chained Queueable calls would be exponentially delayed up to 64 seconds, chaining Batches would be exponentially ...
0
votes
2answers
31 views

My custom object for logging scheduled batch jobs isn't working

I recently created a custom object for logging certain scheduled Apex batch runs, but the code I added to the batchable class doesn't seem to be creating records in the custom object as intended. The ...
0
votes
0answers
14 views

Attachment migration : existing Salesforce to new Salesforce

I have a unique requirement wherein I will have to download and upload 100 GB of attachment and upload it in a completely unrelated new instance of Salesforce. The client creates almost 500 MB of data ...
1
vote
2answers
64 views

Test Class for BATCH APEX[Constructor not defined: [ModifiedDate_Test].<Constructor>(String)]

I am having trouble creating a test class for this particular class. If anyone could provide some code that would implement this I would be very grateful. Many thanks CLASS global class ModifiedDate ...
0
votes
0answers
55 views

Apex CPU time limit exceeded error for batch apex

I want to implement a batch sequence that takes a query of all the Territory Managers in the company and mark the top 15 Accounts as Focus Accounts. The Territory Owners field is a text field. The ...
0
votes
0answers
18 views

Is there a way to define and execute a class in the developer console?

I want to do some analysis of records for an object. The problem is that there are some values on some records, maybe say 57 out of over 1.7 million, that I need to see what kind of data is being ...
0
votes
1answer
51 views

How to send a birthday notification?

using batch apex i did it.code is saved successfully email is not sent. Below is my code: global class BirthdayNotificationBatch Implements Database.Batchable <sObject>{ global ...
1
vote
1answer
44 views

Batch Apex Governor Limit and Managed Package

If a certified managed package initiates batch apex, does it come under governor limits of native org for batch apex? e.g. per documentation: The maximum number of asynchronous Apex method ...
1
vote
1answer
58 views

apex batch queries

I am creating a batch apex that takes some objects and move them to a new custom object before deleting them. I also need to delete other objects connected to the first one, therefore I would need to ...
2
votes
1answer
35 views

How to commit after Database.setSavePoint()

I have a batch Apex job that is currently wrapped in a single transaction, so that any exceptions will roll back the entire batch job. I'm fighting locking issues in SF, and as part of this, I'd ...
2
votes
2answers
84 views

Batch job works when run through Database.executeBatch(), but doesn't when scheduled

This one is a bit odd and I'm hoping it's something someone has seen before. I wrote a batch class that implements both Batchable and Schedulable. I found that I was writing schedulable classes for ...
1
vote
0answers
20 views

How can I run batch apex inside of batch apex?

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

what should be the start method of batch class?

global class batchAccountInsert implements database.Batchable<sObject> { global Database.Querylocator start(Database.BatchableContext bc) { String query = 'select Name,Industry from ...
1
vote
1answer
29 views

Finish method in batch job not invoked after an exception is thrown and caught

I'm using Database.update in my batch class. This is wrapped around by a try/catch block. When I run the batch job some error occurs which is caught as I'm throwing a custom exception and catching it. ...
1
vote
2answers
61 views

First Error: Duplicate Field Selected

What could be the possible reasons of this Error Message. I have written one Batch Class - I first got CAN_NOT_UPDATE_CONVERTED_LEAD and then above error Now I have update my Query ...... From ...
0
votes
0answers
70 views

API/Apex for modifying Batch Apex Flex Queue

I looked forward to the Apex Flex Queue that became GA with Spring '15. However, in actually trying to use it, I'm baffled as to how this is useful in its current implementation: How do I reorder ...
1
vote
1answer
21 views

Overnight debugging of a specific user

Anyone find a way to extend the logging capability of the developer console, or perhaps an appexchange app that will allow extended exception logging for overnight batch apex and integrations? Trying ...
3
votes
0answers
44 views

Batch performance impact of Database.Stateful

I know that a Batch will generally run faster when the Database.Stateful marker interface is not used. What I don't know is, how badly the serializing and deserializing of state between each execute ...
-6
votes
1answer
95 views

Please answer me some Interview question [closed]

I have some interview question anyone here please provide me answer to these questions. 1) Can a batch call from another batch class? 2) If there are 100 Account and 100 contact records as result. How ...