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
21 views

how can improve code coverage of this batch class..i m sending data of query still data is not sending in batch class

this is my main class global class BatchJobContractRetention implements Database.Batchable<sObject>,Schedulable{ public void execute(SchedulableContext sc) { ...
0
votes
1answer
11 views

Clone record with changes in few fields

I have below execute method of an apex batch class where I need to clone Question_Response_vod__c records of existing with changes in few fields. Can someone please guide me here. I have in code to ...
-1
votes
1answer
29 views

Cron Schedule Mondays 6AM

How can I schedule this batch class to run on every Monday at 6AM? public class BatchCount implements Database.Batchable<SObject> { public Database.QueryLocator ...
1
vote
2answers
24 views

How to manage multiple data in input with a Bulk

I've got this problem to solve. I've an apex batch that updates some records all together when a condition is verified. This triggers a Process builder that calls an Apex Class or whatever it might ...
-1
votes
1answer
26 views

Test Class is not getting covered Messaging.SingleEmailMessage in batch class

Test Class is not getting covered for singleemailmessage. Part of Code : global void execute(Database.BatchableContext bc, List < Contract > recs) { List < ...
0
votes
1answer
33 views

Help in test Batch class

I have a Batch class and written a test class where the code coverage is displaying as 50% only.How to cover the single message email in the test class . Batch Class : global class ...
1
vote
1answer
30 views

How to do searching from 10 million records [closed]

There is an object and it has approximately 10 million record and i want to apply searching in VF page can any one tell me how to do that without reaching the governor limits. Any idea or some code ...
-1
votes
1answer
28 views

how to add if else condition in batch class

Based on the requirement i have a Batch Class . Small info needed ...in query locator i have given the conditions for all needed .Now i would like to add if - else condition for one of the condition ...
1
vote
0answers
18 views

Using email templates where targetobjectid is user

Objects: Obj1 and Obj2. Obj2 is child of Obj1. Obj1 has a lookup to user object(User__c). I have a batch class wherein i am trying to schedule emails. I want to use an HTML email template. The ...
-1
votes
0answers
13 views

send and stop email notification based on the conditions

I'm attempting a requirement ,an email notification to be sent 100 days before the contract end date to the owner.We have few condition and a field as "RR" which will be updated once the email is ...
1
vote
2answers
31 views

SendEmail failed. REQUIRED_FIELD_MISSING, Missing targetObjectId with template:

Can any one help me out with this error . 1)When im using mail.setTargetObjectId(c.CustomerSignedId); the system start throwing a error . SendEmail failed. First exception on row 0; first error: ...
0
votes
2answers
30 views

Batch Class add condition in the query

I have a batch class where would like to add few condition in the query,how to add them.Any Suggestion please. 1)I would like to add more roles (such as EB ,TA ,RA etc where role is a picklist field) ...
2
votes
2answers
75 views

Concurrency issue on Batches

I have two batch classes that run concurrently. Let's call them Job A and Job B. Job A inserts records in object A. And Job B in object B. Object B has a lookup to Object A. Because this lookup is ...
1
vote
2answers
22 views

How to make callout from a batch class without Statuscode 500

I have a batch class which basically does a soql of to get a list of account records. In the execute, i want to get the list returned and pass them to a Http callout function which will do a Post ...
-1
votes
1answer
24 views

Batch apex email query

Leads that are older than 1 month with Approval Status ‘Rejected’ should be emailed in the form of an ‘excel file’ to the System Administrator predefined in custom setting and should then be deleted ...
0
votes
1answer
17 views

How to write a test class for HTTPCallout in batch class

I have a batch class which contains HTTP callout, I have seen the blogs for it httpcalloutmock, But I am not understanding how to do it in batch class. Any help is very much appreciated, thank you.
3
votes
2answers
52 views

Batch Class Error as System.StringException: Invalid id at mail.setTargetObjectId(c.Owner.Email)

I have a written a Batch Class to send an notification email 60 days before the contract end date.I have created the email template and used in the code.But the system throws an error as : Batch ...
0
votes
1answer
18 views

How can I call a Batch class from test class?

This is my batch class: global class changeMultipleContactName implements Database.Batchable< sObject > { global String name; global String n = 'Helly'; global ...
6
votes
1answer
57 views

Batch Apex - Need help

This is my first time trying to use batch apex. I copied the example from Trailhead and attempted to move my class code into it. I don't think I have the aggregate query coded correctly but I don't ...
0
votes
0answers
19 views

Batch is scheduled but cannot see any run logs in 'Apex Jobs'

I have a batch scheduled as can be seen in ‘Scheduled Jobs’ but somehow I am not able to see the logs in ‘Apex Jobs’ table. Therefore , I am not able to understand if the batch runs or not. I have ...
-1
votes
0answers
31 views

Help In Batch Class

Based on the requirement i have written a batch class.The Scenarios is i need to send an email notification 90 days before the contract end date to the contract owner.Where the contract role should be ...
2
votes
1answer
77 views

How to create thousands of records using batch apex

I have a scenario where I have to create 30000 contacts and 15,000 accounts (i.e. 2 contacts per account) in an org. I have been trying to do this by using batch apex but I still have error of "First ...
2
votes
1answer
43 views

SOQL Limit Hit - Aggregrate

My query hit the 50,000 record limit. Can someone help me rework the query so it operates within the limits. For reference, we have one account that has 92,000 active employees. The aggregate ...
0
votes
0answers
24 views

Test class not executing scope

I am implementing a batch to delete few records. I am querying in start for records to be deleted and deleted the whole scope like this, public void execute(Database.BatchableContext info, ...
3
votes
1answer
34 views

Catching exceptions when using Batchable with custom Iterable/Iterator

When using a custom Iterable/Iterator class with Database.Batchable, if the Iterator throws an exception it seems impossible to catch the exception. Is there any way to catch the exceptions thrown in ...
0
votes
1answer
18 views

issue adding csv file attachment to email in Batch job

In a batch file we are updating records, and for each one we are creating a record which is sent in an email when the batch completes. It all works swimmingly except that the csv file is sent as an ...
0
votes
0answers
26 views

Attchment on Opportunity in Batch apex

I have a requirement of creating an excel or pdf from batch apex. I insert few records in batch on some business logic. There are few records which i skip from creation if the logic is not satisfied. ...
5
votes
0answers
22 views

Behavior of QueryLocator in Batches [duplicate]

I have a batch job that reads records from a table and does some processing. During the execute method, these records are deleted. This job can, under certain circumstances, be running more than ...
4
votes
2answers
59 views

Testing scheduled apex: CronTrigger does NOT fire after Test.stopTest()

EDIT for clarification of title: CronTrigger is probably actually firing at some point in the testing process - what is wierd is that CronTrigger.TimesTriggered is NOT incrementing after ...
1
vote
2answers
43 views

Why we can not create our own batch interface? [closed]

why we need to implement database.batchable interface,instead we can create our own interface and implement it. why we can not do it,even we can make an interface in apex,so could be exact reason for ...
1
vote
1answer
72 views

test method fails with “Attempt to de-reference a null object” but code in class runs

I am getting a strange error when running my test method: @isTest public class Batch_Ent_Update_Eqn_Status_TESTMETHOD{ public static testmethod void testBatch_Ent_Update_Eqn_Status(){ ...
1
vote
2answers
53 views

how to write test class for Batchable

global class operationsDeleteBatch implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { String query = 'Select id from ...
4
votes
0answers
58 views

Database.Stateful and Database.SaveResult in a Batchable class giving internal errors

Usually when I write a class that implements Database.Batchable I end up saving errors in a variable(s) to sort through in the finish method and send out something about successes and failures. This ...
0
votes
1answer
16 views

Increasing code coverage for a scheduled Batchable class

Can any one help me out.In our org we have Test Class for Batch apex and Schedule class is combinedly written but code coverage is displaying 70%.How can i increase the code coverage.ANy help very ...
3
votes
1answer
94 views

Conga Composer 8 - generate document from APEX

does anyone know if it is possible possible to trigger Conga action(generate document/send email with attachment/create attachment) from apex code - best would be trigger or batch. Example will be ...
0
votes
1answer
40 views

Batch Apex Failed First error: Only variable references are allowed in dynamic SOQL/SOSL

I posted a question yesterday check it here, the answer was to create a batch to run the code. i tried to write a batch class to solve the problem knowing that i have never done that before. But ...
2
votes
1answer
58 views

Batch Apex vs Regular Apex

We have a nightly job that will update opportunities for every record in a custom object. Since that custom object will contain only the "updates in the last 24 hrs", we do not expect the volume to ...
0
votes
0answers
22 views

How to run Batch Class from Developer Console

I am unable to execute the Batch Class from below code. I am getting error Constructor not defined: [AnalyzeObjectBatch].() AnalyzeObjectBatch ab = new AnalyzeObjectBatch(); ...
0
votes
1answer
40 views

Batch finish method getting null values

I'm implementing an apex batch process. public class BatchName implements Database.Batchable<XYZClass.wrapper>,Database.Stateful{ I have declared an integer variable as public and assigning ...
3
votes
1answer
83 views

How can I check batch apex results?

I'm fairly new to SF. I've managed to write and execute a class to update a field by batch. What would be an appropriate way to generate and view information on how my job went for the administrator? ...
1
vote
2answers
42 views

About using Test.startTest() / Test.stopTest() for batch execution testing purposes

just right now, while deploying some code from Sandbox environment to the Production one, I was noticing something strange within a test class that should have the aim to test a Batch class. I notice ...
1
vote
2answers
28 views

Apex Batch Email Notification-Test Coverage

I have a batch job which sends an email notification in case of any failures and the logic is working fine. However I am not able to write code coverage for the email part and it is due to I am unable ...
0
votes
1answer
35 views

Batch apex execute method not invoked

I copied this code from SF docs and modified it to my requirement: global class OwnerReassignment implements Database.Batchable<sObject>{ global final string query; global ...
2
votes
1answer
64 views

Batch Apex Error

Problem We are launching a Batch Apex process containing 430 batches (200 records each batch). We've ran it 4 times, all times it finished successfully without any error, but not all batches were ...
0
votes
1answer
42 views

Is it possible to call Batch from a future call?

I was wondering if it is possible to call a batch from a @future method? The reason I am asking as you may have guessed is because I am trying to call batches from a trigger. Eg: Leads are inserted ...
3
votes
2answers
25 views

Test class for a batch - variable does not exist

I wrote a test class for my batchable class. It works great but I want to limit the query of the test class only to the test object I have created. So I have this inside my test method: String query ...
5
votes
2answers
123 views

Scheduling an apex batch

I have a batch and now I want to create a schedulable class to run the batch every Saturday at 1AM. I was following the salesforce docs but cannot seem to grasp everything correctly. Here's my ...
2
votes
1answer
16 views

Batch being blocked by a trigger

I have a trigger that prevents update of a specific field. At the same time I have a batch that is supposed to update that field. How do I make the trigger allow the batch to run its job?
1
vote
1answer
38 views

Check if an error occur during batch process

Good day everyone, I create a batch process class. The problem I have at the moment, is that how will I check if there is an error encountered during the batch iteration. In my case, I've tried to ...
2
votes
1answer
39 views

Apex test for batch

I am writing test class for two batch classes, X and Y.I executed batch X from one test method between test.starttest and test.stoptest.This works fine. Issue: The issue is I'm inserting few ...