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
0answers
28 views

How to use LastPublishedDate in test classes [duplicate]

How to use LastPublishedDate in test classes, iam using it in Batch class which queries and returns articles which are published 1day before ? while writing test class, i am not getting coverage ...
0
votes
2answers
44 views

Problem Creating test class for Knowledge Article Batch Apex

I Have Batch apex which will send emails when a article was published yesterday(we have scheduled to run daily). I have written testclass for it,but iam getting only 6% coverage.Please help me in ...
0
votes
2answers
44 views

NullException in Apex Class

My below code is getting a NullPointerException: LINE 38 Account_List_vod__c acctListRec = nameToAcctListMap.get(affRec.To_Account_Value__c); I am unsure why I am getting this NullException. ...
1
vote
1answer
44 views

System.LimitException: Too many SOQL queries: 201

I know that this error is fed up, but i'm really doesn't know what i'm doing wrong? So the process: The batch starts every day and checks the value of FirstDateOfMonth__c = Today() and update the ...
0
votes
0answers
20 views

how to trigger an event based on visual force page new version deployment

We are trying to build a tooltip navigator on VF page which will help the users to get a navigator demo for the first time once demo is completed we will be turning this off on the user level, but on ...
0
votes
0answers
20 views

Error in running Insert Account List Item class

I am really new in apex class. I hope you can help me, I created a batch job to create/insert Account List records. Link to my batch job question: Help in converting my apex class to batch job This ...
0
votes
2answers
36 views

Help in converting my apex class to batch job

I hope someone can help to convert my class to batch job. This is the first time that I will create a batch job and only a newbie in apex coding. Here is my class which is working but hitting the DML ...
0
votes
0answers
36 views

System.DmlException : Error when Trigger is executed with Batch [on hold]

I have a batch class that creates a clone for each of the existing records on my custom object (Rate__c) and updates the field (Rate__c.Status__c) of all the old records. I also have a trigger on (...
0
votes
2answers
49 views

How to retrieve more than 50000 Records in a single query

I am running Batch Class for Migration of Records for Particular Object and I am storing Failed Records in an another Object. Now I have run the Batch and I got 1,00,000+ Records which are Failed. But ...
3
votes
1answer
38 views

Apex Batch Size Error - AsyncApexExecutions Limit exceeded

I have written a Batch Class which will Map Contact Object to lead Object. I have 6,000,000 which will be Mapped to Lead (like i am creating Lead using Contact Details). But when I am running the ...
-4
votes
0answers
19 views

How to write Test class for the below batch class? [closed]

global class Batch_sales_load implements Iterator<AggregateResult> { AggregateResult [] results {get;set;} // tracks which result item is returned Integer index {get; set;} ...
3
votes
3answers
33 views

How to force test class to run batch only once

I am writing a test class for batch class. but it is throwing error: System.LimitException: Too many async jobs enqueued for this apex test context Stack Trace External entry point I am ...
0
votes
1answer
30 views

Batch class for mass deletion of Accounts

I've been trying to learn batch apex and for it I've written following code with the purpose of deleting accounts in mass. However, when I'm invoking it I don't see any of the accounts getting deleted....
0
votes
1answer
29 views

FATAL_ERROR|System.LimitException: Too many callouts: 101

I am trying to do a batch update that enters geocoordinates for 2000 records of a cuctom object called Property__c without gecoordinates using the following code: Batch global class ...
0
votes
0answers
21 views

Batch class not running? [duplicate]

I've created this class as to schedule a batch class to run every 15 minutes, however it isn't running at all. Can anyone spot the error here? global without sharing class OppBatchSchedule implements ...
1
vote
1answer
44 views

Needs to be Removing from Specific roles from Opty Team members

We have an Opportunity name called as "Test Opty" and Opportunity owner name as some "ABCD". In that opportunity we have two related lists called as "Opportunity Team" and "Open activities". In the ...
2
votes
1answer
32 views

Test Class for Batch that sends callout

I'm unable to cover an execute method of a batch class. Do I need to use a mock class for response? It's my first time testing a batch class with a callout. Following is the method... global void ...
1
vote
1answer
19 views

Batchable Interface finish method and sending email from managed package

We are using the Database.Batchable interface. In the finish method, we want to send a mail to the user who started the job like this: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/...
1
vote
1answer
40 views

How do I maintain state for Dom.Document type variables between Start and execute method of a batch

I want to create a XML Head in start method of a batch class. I was getting "System.SerializationException: Not Serializable: dom.Document" error for DOM. To handle this I declared all the variables ...
2
votes
1answer
17 views

Bacth Apex class to update- below code is not working

I want to update all StageName='Perception Analysis' Opportunity every when i am created. I am getting global class BatchApexUpdateOpptyStage implements Database.Batchable<sObject>{ ...
3
votes
2answers
49 views

Way to get the batch size that a BatchableContext was called with, from within the batch?

I am writing a chained batch process that will be called by another method via a Database.executeBatch() call that specifies the batch size. I am trying to figure out how to pass that same batch size ...
0
votes
1answer
34 views

Deleteing multiple SObjects in batch apex

I have the following code that executes exactly how I need it to, the only issue is I receive "Apex CPU time limit exceeded" when I run the delete on Accounts, EmailMessage and update Cases. After ...
0
votes
1answer
20 views

Keep records in master Set with no Ids

I'm using a master Set to keep all created records and to remove duplicates before insertion. The problem is that once the record gets inserted, it gets Id assigned to it and records in master Set get ...
1
vote
0answers
27 views

Concurrent Batch Apex limit Managed Package

We are unclear about the Concurrent Batch Apex Limit of 5 and how to handle it. We have a Managed Packed and want to utilize the Database.Batchable interface. When using Database.Batchable interface ...
0
votes
2answers
27 views

Which will be better for updating millions of records either trigger or batch class

I need to updated millions of records which is of currency type.So i need to write business logic for the same.So shall i go with trigger or Batch class. In the case of a trigger, every time an ...
2
votes
1answer
83 views

Too many DML rows: 10000

I have a batch job that does lots of calculations and batch size is reduced to 10. Reducing batch size further is not an ideal option at this time due to other factors so to catch Too many DML rows : ...
0
votes
3answers
41 views

Batch Apex StartTime and EndTime

I have written Batch, class. I want when my batch class gets Started and it gets ended. Thank you for help..
6
votes
2answers
102 views

Why do static and non-static lists behave differently in batch and test contexts?

Given the following batch code: global without sharing class POCBatch implements Database.Stateful, Database.Batchable<Sobject>{ public static List<String> staticList = new List&...
0
votes
0answers
26 views

ExactTarget REST API How to send Batch Triggered Emails without using sendBatch

I can send batch triggered emails using sendBatch using the REST API. Ex. https://www.exacttargetapis.com/messaging/v1/messageDefinitionSends/key:858585/sendBatch But I can't find any documentation ...
0
votes
1answer
25 views

Can't insert or update Activite entity on Trigger_name : execution of After update

I written a batch class on case to update the one field on case object. And i written a Trigger on case to update the field on Entitlement object. And Trigger is working fine. But when i run the batch ...
0
votes
1answer
19 views

Need to update a pick-list field based on the reminder date field

I have a requirement to update a pick list value when a record meets the reminder date. There is a field called reminder date in my object and when this reminder date is equal to my current date then ...
0
votes
1answer
24 views

How to Calculate Batchable Instance Size?

I was getting error during batch execution "Batch Instance size is too big" Is Batch Instance size is different than Heap Size? Which variables contributes towards the batchable instance memory?...
2
votes
1answer
38 views

Test class for Scheduled class not created records?

I'm having trouble figuring out why, when executing Test Class, which fires a Scheduled Class and the Batch Class within it, data I expect to be there, isn't. @isTest static void ...
0
votes
1answer
17 views

Setting FromAddress for MassEmailMessage

Is there a way to set the From Address when sending MassEmailMessage via a batch job? Ideally I want to use OrgWideEmailAddress but I don't see any method to apply that. Neither can I find a way to ...
1
vote
2answers
45 views

Query is either selecting too many fields or the filter conditions are too complicated [closed]

How to select deal with this issue GlobalDescribeMap = Schema.getGlobalDescribe(); string fieldStr = ''; Schema.DescribeSObjectResult objResult = GlobalDescribeMap.get(objectName).getDescribe(); Map &...
0
votes
1answer
32 views

Evoking an Apex batch class from a Time-Dependent Workflow Action

I am trying to call an apex batch class after a set period of time. I was thinking of using Time-Dependent Workflow Actions to achieve this, but how would I make the batch class call?
0
votes
1answer
54 views

Test class not covering code in batch apex

HI I created a batch apex but my test class is not covering the entire code, not sure where i am going wrong. Looks like query in start method is not returning any test records which i created. Please ...
5
votes
0answers
64 views

Disadvantage To Using Batch?

This answer got me wondering, is there a disadvantage to using a Batchable for simple scheduled functionality, as opposed to executing the functionality purely via Schedulable? Its [sic] better to ...
0
votes
0answers
13 views

Batch process with external API calls progressively consumes more CPU time

I have a batch process that calls an external API, updates fields on Contact and Account records, and creates a new record on a custom object. For some reason, CPU timeout occurs after the first 30 ...
12
votes
0answers
239 views

Batch start CPU timeout - What influences start() post-processing?

We're experiencing a very annoying issue with a Batch job processing "Large Data Volume" (1.5M records over a table containing 4.5M records). Our batch start method last statement is: return Database....
3
votes
0answers
50 views

Unlock parent, then update child, then again lock back the parent

I have a batch class that is used to update a Field1 of Obj1. Obj1 is child of Obj11. Inorder to update Obj1, I need to unlock its parent Obj11 first. [by updating lock__c=false]. Then update ...
3
votes
1answer
35 views

Passing a set of record Ids from a Stateful batch class to another batch class

I have an ever-evolving set of custom rollups from Tasks to Accounts, Contacts, and Leads. When I add a new rollup to the code, sometimes I need to calculate the value for all parent records. I've ...
0
votes
1answer
23 views

getting this type of error “Error: Compile Error: expecting a semi-colon, found ')' at line 20 column 23 ”

Here is my complete code sample global class b1 implements Database.Batchable<sObject> { global final string query; global final string s_object; global final string field; global final ...
0
votes
2answers
90 views

Test not cover the execute method in batch

I'm trying to search in enternet but no results.... So i haveing a batch that updates records (IT_Asset__c) if the FrstDayOfMnth__c = true. After that fires the trigger. The apex test class not ...
-1
votes
1answer
55 views

Put a counter in batch apex class

I have a batch class in which i need to put a counter to count all the records that are processed successfully. My code is as follows: global class BatchUpdate implements Database.Batchable<...
2
votes
1answer
26 views

Batch Job with Custom Iterable throwing error First error: Invalid conversion from runtime type CustomIterable to System.Iterable

I get the error First error: Invalid conversion from runtime type CustomIterable to System.Iterable when trying to use a customer iterable in a batch job. My custom iterable class: global class ...
4
votes
1answer
45 views

Less resource expensive way to perform this scheduled task

I need to schedule anually a batch, on January 1st every year. This batch has to process all accounts to update a checkbox field. I'm trying to decide what is less expensive for the platform, so I can ...
2
votes
1answer
25 views

Explicitly change the context of User while scheduling a batch

I have a requirement where I schedule a batch to run via trigger on insert and update event. However, the batch schedules in the context of the User who makes the changes. Because of which the ...
2
votes
2answers
69 views

Working around callout limit in Batch Apex

I have a batch Apex class that makes a callout to an API that returns records in pages of 25. It also tells me how many pages there are so essentially I do - so I have a loop that then goes through ...
3
votes
1answer
35 views

Best way to automate updating contact emails in sandboxes post refresh?

I'm looking for a way to automate the process of updating emails of all active contacts in sandboxes (mask them with the .dev or .test). Number of records to update after filtering: 900,000 Things I'...