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
1answer
22 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
17 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
18 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
75 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
36 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
1answer
94 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
19 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
23 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
16 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
33 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
14 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
43 views

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

How to select deal with this issue GlobalDescribeMap = Schema.getGlobalDescribe(); string fieldStr = ''; Schema.DescribeSObjectResult objResult = GlobalDescribeMap.get(objectName).getDescribe(); Map &...
0
votes
1answer
27 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
48 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
55 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
12 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
226 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
47 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
28 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
22 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
67 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
54 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
20 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
44 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
21 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
67 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
33 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'...
0
votes
0answers
34 views

Data Loader, CLI “External_ID__C not specified”

I'm trying to import a CSV over the Data Loaders CLI. When I import manually using the same Account, CSV, and Mapping it works. Error: ERROR [ImportKF] client.PartnerClient processResult (...
0
votes
0answers
22 views

How to test batch with callout with triggers

I have been trying to write a test class for a batchable apex we have for a few days now, and I think I have identified that a managed package has a trigger that is causing a DML event on insert of a ...
0
votes
1answer
31 views

Do Trigger DMLs count on Batch Callouts? [duplicate]

Our instance has some triggers that fire before insert and before update on accounts, contacts, and leads. In a test class, if I am creating test records will the insertion of new account records ...
3
votes
1answer
74 views

Error: Too many query locator rows: 10001

I have batchable apex that is throwing the Too Many Query Locator Rows error: Global Class FocusDomainBatch implements Database.Batchable<sObject>, Database.allowsCallouts { global ...
0
votes
1answer
29 views

how to pull opportunity owner name in test class

I wrote a batch class to send email to opportunity owner when the opportunity's close date is passed. global class SendEmailToopsowner implements Database.Batchable<sObject> { global ...
0
votes
0answers
18 views

Performance degradation in salesforce sandbox - batches and asynchronous are taking too long time

We are running start of day and end of day jobs before and after the business hours, but from around 4 days we are observing even without any data sets the batches are taking too long to run. ...
0
votes
0answers
31 views

send email alert to opportunity owner when opportunities closed date has passed

I want to send email alerts to opportunity owners when their opportunity close date passed. Let say if an opportunity owner have 4 opportunities with same close date so only one email alert should ...
7
votes
2answers
382 views

System.LimitException: Too many async calls created: 2

I am trying to run two batches: 1.ContactNonEligibleMarker - Updates a status on the contact 2.RelationshipCreatorForContact - Creates child records(Relationship__c) under a contact. In the finish ...
-1
votes
1answer
23 views

how to create automated batch job with fixed width file format [closed]

My object name is Account and it has fields(length): Name (10) Account Number (8) Email (15) Phone (10) The query should fetch the data from the above object and download it as a fixed width text ...
0
votes
0answers
36 views

Facing issues with batch jobs in different sandboxes

I've built a batch job in our dev instance, that appends all the emails with '.dev' at the end, which is really simple and a common problem to avoid users getting sandbox emails, however, strangely ...
0
votes
0answers
29 views

Sending an email alert when query rows are more than 50K

We have a apex job in which we are fetching some records(SOQL) in execute method based on the record values retured by start method. But, there are more than 50000 records corresponding to one ...
0
votes
0answers
23 views

Update fields after clone in apex batch class

I have below code where I need to clone a record but change some of it's values. When I try that, it simply seems to do no change on newly cloned record. Can someone let me know how to achieve it? My ...
0
votes
0answers
28 views

how to send email to Account Owner from contract object in Batch Class

Can any one help me out . How to send an email to Account Owner from contract object in Batch Class.Im using templateid ,in target object im giving the contact id ,in whatid im sending the Account ...
1
vote
2answers
64 views

Batch Apex Query - when multiple batch jobs fails

Just a quick query on Batch Apex. Let us say I have about 8000 Opportunity records to process in our nightly batch job. The objective of this batch is to update a field on Opportunity if it matches ...
0
votes
2answers
26 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
28 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
31 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 start(Database....
1
vote
2answers
36 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
30 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 < Messaging....
0
votes
1answer
39 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
33 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 ...