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

Bulk-API: How to add a batch with both CSV data and a query?

I'm trying to use Salesforce's bulk API to run a query on some CSV data. Here is the desired result: In SF, we have a field product.serial__c. I have a CSV with a bunch of serial numbers that I would ...
1
vote
1answer
30 views

batch apex query - ORDER BY doesn't sort all records?

I have a Batch Apex process that queries about 12,000 Contacts - sorted (descending) by a number field. My process ranks these records based on the sort order (record with the highest value in the ...
2
votes
0answers
16 views

Append content to a document

I need to create a huge document. Naturally I face up the apex's limits such that heap size and string length. I can split the creation of the document using a batch job. I thought to create the rows ...
1
vote
0answers
22 views

AsyncApexExecutions Limit exceeded error for apex batch

I am getting "AsyncApexExecutions Limit Exception" in below code - Can anyone explain the issue? i have been getting more than 1 lakh records in start method using queryLocator but didn't get this ...
0
votes
2answers
34 views

How to test Batch apex that executes another batch job

I have a batch job that does the following : Makes Http callout Create Cases Calls the next Batch job (In the finish function) i.e. public Void finish(Database.BatchableContext context) { if ...
0
votes
0answers
15 views

Rollup-Summary: wrong values due to delayed update

We are creating ~20.000 parent objects with ~500.000 child objects with an apex batch process. Those records are then taken and further processed in a second batch. The parent objects do contain ...
2
votes
1answer
26 views

Prevent trigger from running in single test

Ok so I have a fairly complex scenario I need to test... I have a Trigger on a MyObject__c that creates PermissionSetAssigments when MyObject__c is inserted. Because PS Assignments are system ...
0
votes
1answer
31 views

Batch Apex creating Duplicate records

I'm clutching at straws here a little, but has anyone ever come across a situation where a Batch Apex routine creates duplicate records, possibly as a result of the execute method running more than ...
0
votes
2answers
38 views

Batch process with Scope giving: “Too many SOQL queries: 101”

I wrote a batch class to avoid the "Too many SOQL" error. Works fine in my sandbox fails verification in production. Looking at my code below, is there something else I need to add? I tried setting ...
0
votes
1answer
27 views

Pass getQueryLocator values to Batch Execute parameter

I'm really struggling to learn this batchable process so i apologize ahead of time!!! Having said that.... I am trying to kick off a limited batch record update process. I think I have this part ...
0
votes
0answers
17 views

Identify user edit vs system update

Question : Is there a way to distinguish between a user edit and a system edit in salesforce? Scenario : SFDC sends data to an external system ( very basic system that can process very few records ...
0
votes
1answer
26 views

Set number of records to process in Batch process

How can I set a limit on the number of records processed in my batch process? Say the QueryLocator pulls 500 records. I'd like to break this up so 500 records are processed 10 records at a time. ...
4
votes
2answers
63 views

Concurrent Batch Job Limit of 2?

Under what circumstances does an org have a concurrent batch job limit of 2 rather than 5, and is there a way to determine this in apex? We have code that assumes that 5 batch jobs can be scheduled ...
1
vote
2answers
207 views

Trivial batch job in test failing

I have a scenario where a trigger should take certain actions based on the number of Contacts assigned to an Account: If a Contact has no account assigned it will look for a special "Unassigned" ...
0
votes
0answers
16 views

Write a batch class which will delete the saved files from that folder

Can any one help me out this ? Write a batch class which will delete the saved files from that folder and e. Batch will run every week.
0
votes
0answers
41 views

Batch interrupted with 'Aborted by user' error

I have a batch class scheduled to run periodically, but seems that for some unknown reason, it gets aborted(Under Setup -> Apex jobs, Error: 'Aborted by user'). I know that the error means, that ...
0
votes
1answer
31 views

Creating a many opportunities from contacts once a month

I'm new to Apex/SalesForce and I'm trying to figure out how to create a scheduled job to create many opportunities based on Account information. It needs to create opportunities for all contacts with ...
0
votes
0answers
18 views

“SerialBatchApexRangeChunkHandler” Opeartion while Running Batch Class

Please Help me. I Got this Error Message while Running Batch Class Delete failed. First exception on row 0 with id 00P17000000OaUNEA0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ...
4
votes
2answers
70 views

Why is this Apex Class dependent on a bunch of completed Apex Jobs?

I've got a Batch Apex Class like so. (It happens to use the Dan Appleman decoupler pattern, augmented for batch. Thanks Dan!) public with sharing class Dispatcher implements ...
2
votes
1answer
45 views

Object View ID as filter id with StandardSetController limit 10k

Database.QueryLocator ql = Database.getQueryLocator('select id from account limit 1'); ApexPages.StandardSetController setController = new ApexPages.StandardSetController(ql); ...
1
vote
1answer
73 views

How do I pass an external variable into batch Apex?

I have a map variable that I am trying to pass into a batch class. This variable was created and populated in another batch class (which is why I can't just create it in the Start() method of the ...
0
votes
0answers
13 views

How to Delete Account Related Attachments Using Batch Apex?

Hi Please Tell me anyone, How to Delete Account Related Attachments Using Schedule Apex or How to Take Related Account Attachments to bring SOQL Query ? Thanks in Advance
3
votes
1answer
44 views

Compiled successfully, update not happenning

I have below batch class that is not doing DML update operation also no error in debug log. Can someone please help me here? Batch class: global class AckCallUpdatenew implements ...
1
vote
0answers
19 views

Sync Track trigger not working

This might be not directly a salesforce issue. I work in Veeva. There is sync tracking custom object in Veeva where records of User syncronization from Ipad is stored. I have to run a after insert ...
5
votes
1answer
715 views

Too many if statments?

So the Apex docs say you have to set the value of the master record if you want to retain the discarded account field values before the merge operation. Is there a better way to do validation for a ...
2
votes
1answer
15 views

Sync object not getting keyset

I have a custom object of Sync Tracking that allows to keep track for Users , when they are doing a sync from their ipad to salesforce. Now I need to write a trigger on that object, Sync Tracking ...
1
vote
1answer
15 views

Initial term of field expression must be a concrete SObject: LIST<Call2_vod__c>

I am getting subject error with below code. The line number is on update statement conditional if clause. But I can't get why I am getting such error? I have a trigger validation for those ...
-2
votes
2answers
37 views

Continue not working properly

I have below code where I do a check if a list value is contained in a set then jump to next iteration without executing the next statement that is update. Here I am using 'continue;' statement in ...
1
vote
1answer
22 views

Incompatible element type String for collection of SOBJECT:Call2_vod__c

I have the below code where the Set and list is of same type Call2_vod__c , a custom object in salesforce but still throws subject error in that line. Can some one help me here? Apex class: global ...
0
votes
0answers
14 views

Import Large CSV file using Batch Apex [duplicate]

I have a requirement to read a large csv file and insert into database. My code works fine for 3000 records but after that it gives me CPU time exception or Regex is too complicated. So, I thought to ...
0
votes
1answer
27 views

Error in debug log though class compiled correctly

I have below batch class which compiles correctly but throws error runtime says expecting colon Error: FATAL_ERROR|System.QueryException: expecting a colon, found '(' ...
1
vote
1answer
41 views

First error: invalid character encoding - Apex Job

I have written an apex batch that was working before sendbox refreshing. When I try to run the batch I get this message in the Status Detail: First error: invalid character encoding Instead in the ...
0
votes
2answers
52 views

Please help! First error: Too many query rows: 50001 in my Batch Job

please help on my Batch Apex Job, it kept on prompt me error 'First error: Too many query rows: 50001' and i cant reduce the result return from my statement, i need to process all data, can anyone ...
3
votes
1answer
56 views

is it possible to call a single batch job from multiple schedule apex?

Hi i would like to know is it possible to have multiple scheduled Apex calling a single Batch Apex? The reason why i have multiple schedule apex is becaus different each 1 excute a different record ...
3
votes
1answer
59 views

Do we allow CRUD & FLS in each component of Apex?

Can I write CRUD & FLS Enforecement codes in following : If not in any of these - then Why ? Apex Class - YES Apex Trigger - ? Apex BatchClasses - ? Utility Classes - ?
0
votes
1answer
23 views

Why Batch can't work in unit-test? [duplicate]

There are 2 methods will callout and insert.I wrote 2 batches to invoke my method. I use the one invoke the other one to avoid System.CalloutException,and it's useful when i run them. global void ...
1
vote
1answer
22 views

Question on an interesting map syntax

I recently came across a rather interesting syntax of a map in a batch apex which I would be grateful if anyone can explain to me how it's actually working: global class CommissionSharingRecalc ...
1
vote
1answer
47 views

Test cases for the Batch APEX sending Emails

Need help in increasing the code coverage for the batch class. I have 5 such similar Batch classes where I have t increase CODE COVERAGE. They are all working fine in production, but due to code ...
1
vote
1answer
25 views

Detecting and retrying CalloutException in Batchable iterable

I have a nightly batchable job in my SFDC org that queries a remote SFDC org for account and opportunities meeting certain criteria. Works great but every so often, I get System.calloutException read ...
2
votes
0answers
89 views

Apex code to Export Csv file to ftp server

I have to write an apex batch scheduler to send user information csv to some ftp server. I am able to generate the csv file with user records but I don't know how to send this csv file to ftp server ...
1
vote
1answer
45 views

Type casting error

I am getting runtime type casting error with below code. Can someone please help? Code: global class batchCallUpdate implements Database.Batchable<sObject> { global Database.QueryLocator ...
1
vote
0answers
18 views

Flexible API Limits—Question

Please can someone confirm the following about Flexible API limits: Provides the ability for me to queue up more than (5) batch jobs for processing. Only (5) jobs are executing at any one time and ...
0
votes
1answer
59 views

Apex Batch : You have uncommitted work pending. Please commit or rollback before calling out

I have a batch class that makes a external Http callout to create case records with a CreatePublicStuffCases() which is called in the start(). In the execute function, I have another callout to get ...
0
votes
0answers
18 views

Within Batch Apex, how to execute query using a list view filterId

I am trying to pull selected view records in Batch Apex Can Any body give me help me how can i make query in Database.getQueryLocator(); to pull all records of the view Query = 'select id,name from ...
1
vote
1answer
41 views

How to test callout in batch

I'm trying test a critical part of an application that is in a batch process and makes callouts to a server. MyObject__c obj = new MyObject__c(name='test'); insert obj; Test.startTest(); ...
6
votes
2answers
97 views

Best practises for speeding up Apex Batch class

My previous question about slow Batches probably was to focused on a specific problem, so I try it again much broader. What are general rules of thumb to make a slow Batch faster? Although I added 2 ...
5
votes
2answers
124 views

Only query Id field in start() to speed up Apex Batch

I am looking for ways to speed up a complex Batch job which takes days to run in a specific customer org. This Batch is snapshoting records of arbitrary objects into denormalized (as a single records ...
0
votes
2answers
44 views

Test Coverage for Batch Class

I have the following Batch class which operates on a custom object (Sample__c) and the default Contact object. My test class goal was to create a list of Samples which I know satisfy the batch's query ...
3
votes
1answer
91 views

scheduled apex to query and create new sObject

I am currently working on creating a scheduled apex to query an external json case objects and insert these objects in salesforce. I am quite new to this framework and quite stuck. The below is a how ...
2
votes
1answer
145 views

Can Queueable solve “Future method cannot be called from a future or batch method”?

I have code that must be called as @future as it requires all the resources one can get. The only problem is that in 1% of the cases this code is called from a Batch and therefore fails with ...