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
1answer
19 views

Loading 1 million records using bulk API: Exceeding batch Limit

Whenever records are inserted in Contacts(usually inserted in 1000's), we have a batch job that checks related customer account in SFDC and populates the contact.accountId field and couple other ...
0
votes
0answers
27 views

INSUFFICIENT_ACCESS_OR_READONLY error when sending email from scheduled class

I have a batch job that send emails on user anniversaries. It works when I run it in the execute anonymous window from SF's developer window. I'm sending it through the org-wide email address and I've ...
0
votes
1answer
24 views

Count records in QueryLocator?

For counting recording of an sObject I would write ... Select count() from obj; But how do I find out the total records in Database.QueryLocator? I hope it's not a dumb question. ...
1
vote
1answer
14 views

Issue with Schedulable implementation and Callout

I am receiving an error message when trying to test a class that implements Schedulable. System.CalloutException: Callout from scheduled Apex not supported. People have suggested using the @future ...
0
votes
0answers
10 views

URL confirmation tool [on hold]

My idea would be to create a batch/schedule class to pull from specific fields (URL's) in salesforce.com on Product2 object and confirm the URL's are "Good" or "Live" or some sort of status other than ...
0
votes
1answer
26 views

Update latitude and longitude through batch apex

When i run my batch apex latitude and longitude are not getting updated in customer object. i need to update 50000 record.. getting lat and long using google API i able to request 2500 record per IP. ...
-2
votes
0answers
32 views

How to run batch class? [closed]

This my batch class: public virtual class Rfleet_DZCallc2gMainProduct implements Database.Batchable<List<String>>, Database.AllowsCallouts { public string jsonStr {get;set;} public ...
0
votes
0answers
37 views

How to set batchsize in batch apex?

I have written a Batch class. The batch class returns totally "108" records. The records are successfully inserted.Its working fine when I run the below Batch class Batch Apex class ...
0
votes
2answers
21 views

Refactoring triggers into batches

Is there any good practices on how to refactor Apex triggers into batch processes? I've been given quite a large trigger that is exceeding CPU limits due to large processing size. The aim is to move ...
2
votes
3answers
51 views

Error: No more than one executeBatch can be called from within a testmethod

I have one batch class which has almost 6k records.I have written test class for the same.But i am getting error saying No more than one executeBatch can be called from within a testmethod. ...
1
vote
1answer
30 views

Test code coverage for Batch Apex Constructor

Source : Please check this link about test class coverage for batch apex My Requirement : What they doing is they having argument contructor on batch apex. like global class CleanUpRecords ...
-1
votes
1answer
29 views

2 Separate batchable jobs or 1 combined one? [closed]

I have a batch job which runs overnight, which currently only uses the Opportunity object. I now have a need to run the same process for the Order object. How would I do that - do I need to create 2 ...
1
vote
0answers
27 views

How to resolve Apex CPU time limited exceeded while running the batch?

I have a batch class Batch apex: public void execute(Database.BatchableContext BC, List<List<String>> records) { Rfleet_GetValues_DzC2G prodData = new Rfleet_GetValues_DzC2G(); ...
1
vote
1answer
26 views

Batch Job-Mass email Contacts

I have a batch job that emails contacts using a visualforce template. I am using SingleEmailMessage to email contacts as the template pulls data from each contact. my batch size is 10 and we have ...
1
vote
2answers
40 views

batch class Run fine with individual record but not working fine with multiple records

I am writing batch class to deactivate users if no dependency and freeze user if any dependency.When i hardcode singal value of userid and run batch it works fine it deactivates user.It is not going ...
3
votes
1answer
31 views

Need to Clarify Batch Apex Callout limit

I am creating a batch apex job that will send an HTTP request to an external endpoint (URL) that can only take in one record at a time. The batch size is not very large. Maybe 500 records or so. It ...
0
votes
1answer
30 views

Workflow is not trigger when criteria is meeting any other approch to achive my requirments

I have checked workflow and it is not working as I expected. According to you workflow Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria and rule ...
0
votes
0answers
8 views

Managed Batch doesn't run

I am trying to run a batch with a snippet of code below: global class RMACarrierStatus implements Database.Batchable<sObject>, Database.AllowsCallouts{ global static sObject ...
-2
votes
0answers
46 views

Getting error on database.update().Not able to add ids of exception users to a set

The error is at line List<Database.SaveResult> results= Database.update(listUserDeactivate,false) (look for /* ### Error on Below Line ### */); I want to catch those users for which exceptions I ...
2
votes
1answer
44 views

The future of Async Apex - everything Queueable?

I know that this is a somewhat opinion based question but there is definitely interest in the community in where the Roadmap goes. Do I get the blogs and communities and blogs right that we are ...
1
vote
0answers
29 views

Unit Testing Class

I'm having this method which I can't test in my test class. It's my call on my ReplayFuture.cls, wich is called from my oppbatch class. if(replayRecord.MethodName__c == ...
0
votes
1answer
44 views

I want to query all opportunity stages except closed lost. I wrote below batch to update a custom field but it did not work

I have a batch to update a custom field of all opportunity with specific condition I want to query all opportunity stages except closed lost. I wrote below batch to update a custom field but it did ...
3
votes
1answer
46 views

Webservice callout - Test class - not working

I have batch class that makes a HTTP callout to a remote web service. To deploy into production, I have created a test class with StaticResourceCalloutMock. I am executing the test class in a full ...
0
votes
2answers
10 views

Feasibility Question for Public Sites

Just checking with folks here to understand whether the following idea is possible or not. The idea is to expose public Site (no login needed) with a file upload functionality. The end users can ...
1
vote
2answers
13 views

Schedule Trigger by Updating?

If I have a trigger that runs on Campaign update. Can I schedule it by writing a batch that just updates all Campaigns? Or do I need to reproduce the logic of the trigger in the batch itself. IE can ...
0
votes
0answers
23 views

Calling batch apex from Trigger Apex Salesforce

Is it the right practice to call batch apex from Trigger insert??? I want to insert child objects for each parent(1 Parent = 50 childs) 50 childs for each parent.I wrote a trigger on parent object ...
0
votes
0answers
22 views

batch apex status completed but not capturing the details to custom object

---Invalid field SetupAuditTrail for SObject AUditTrial__c-- public class AUditingBatch implements Database.Batchable<sObject> , Database.Stateful { public String query; public ...
0
votes
3answers
21 views

getting error semicolon found on line number 20

public class AUditingBatch implements Database.Batchable<sObject>{ public String query; public Database.querylocator start(Database.BatchableContext BC){ return ...
0
votes
0answers
15 views

Assert after batch job is executed [duplicate]

below test method is failing at system.assert "Expecting 10, actual 0" But system.debug on "total" in the finish of batch class has value 10. Batch class public class CountRecords ...
0
votes
1answer
35 views

BATCH Class - Inner Queries - Questions/Doubts [closed]

I am doing few thing in Batch - and I was curious whether : My SOQL Queries will work with 50000+ records ? Will my SOQL's take too much time to execute and cause Time Out, etc ? SOQL SELECT ...
2
votes
1answer
46 views

Need to change a schedule for apex class

Need to know , How to find a class is scheduled. Assuming since I do not see the system.schedulebatch in either of the classes that it is scheduled. I was looking for the following changes: How do ...
0
votes
2answers
21 views

Batch Class Removing all .pdf Documents Except first and most recent where name is “x”

Similar to my question yesterday, the title pretty much explains what I'm trying to do. I want to remove all .pdf documents from Contact records with the exception of the first and last where the name ...
1
vote
1answer
44 views

How to execute workflows on records that users don't touch

I have a scenario where I have to create an automation on opportunity. When opportunity on stage 1 for more than 14 days & there are no open task in opportunity & last activity age should be ...
0
votes
4answers
32 views

How to write Batch class to unchecked Checkbox

I have Holdback_Expiry_Date__c as date field and Holdback__c as checkbox. When Holdback_Expiry_Date__c given date is expired then Holdback__c should be Unchecked or be false What I have tried so ...
0
votes
1answer
31 views

when event's due date over send email to a fixed user's email (xyz@abc.com)

I want to send email to a fixed user's email address let say (abc@xyz.com (mailto:abc@xyz.com)) when events due date over and description is not filled. I wrote batch but it send to email event owner ...
0
votes
0answers
31 views

Test class for scheduled http callout batch

I am having a bit of difficulty creating a proper test class for the two batch classes I have below: global class CarrierTrackingBatch implements Database.Batchable<sObject>, ...
0
votes
1answer
14 views

Apex Batch Reduce Callout Process Time

From batch class we are able to connect to third party API 5times per second on an average, i am wondering is there any way to increase the callouts per second. I am sure there may be chances
-2
votes
1answer
28 views

Batch code doesn't update record

I have the batch code seen below. It does run, however it does not update the record (Shipping Status) that I want it to update. Any help would be appreciated! global class TrackingUpdateScheduled ...
3
votes
1answer
155 views

Passing Parameter to batch apex

I need to pass parameter to the batch apex class. This is apex class: global class batchNotesInsert implements Database.Batchable<sObject> { global Database.QueryLocator ...
2
votes
2answers
109 views

How to handle error records in Batch apex?

I have a simple requirement to write a batch which will loop through all the records for 'Object__c' and update a custom field on the object(Logic is irrelevant here). Here is the batch class I ...
1
vote
1answer
30 views

Overwrite value of Formula Field

I have a formula field which does some basic calculation. This field has been in the system from the time project went live. As an enhancement there are certain records whose values needs to be ...
-1
votes
1answer
27 views

Apex Class - Tests are passing, but Salesforce shows 0% coverage [duplicate]

My tests are all passing, so I know that my test code is calling my main class's methods. Salesforce is telling me I have 0% coverage though, so I'm not really sure what's going on. (I'm very ...
1
vote
1answer
40 views

Batch Job Error: Too Many queries: 50001

public class UpdateBrandBatch implements Database.Batchable<sObject>, Database.Stateful { final List<SObject> records = new List<sObject>(); final string query1, query2; ...
1
vote
0answers
45 views

Report on the top 20% of Customers Only

I need to report only on Contacts who are contributing to the top 20% of revenue. Payment is stored on Customer which is a Master-Detail to Contact, one Contact can be a Customer multiple times. In ...
1
vote
1answer
33 views

Getting System.CalloutException: You have uncommitted work pending [closed]

I am getting an exception of System.CalloutException: You have uncommitted work pending. Detail of the Exception is given Below: Exception: :System.CalloutException: You have uncommitted work ...
1
vote
0answers
33 views

Future callouts when trigger fires from batch job

I have a batch job that goes through a list of a custom objects and updates certain field. This is working correctly. The custom object is part of a managed packaged. On the custom object is a ...
4
votes
2answers
187 views

Error: Future method cannot be called from a future or batch class [closed]

My requirement is getting latitude longitude from google map for that i wrote trigger and used @future callouts. now i need to run batch class to update contact records but contacts not updating ...
1
vote
1answer
44 views

How to make a synchronous call in salesforce

Is there a way to make synchronous call in sales force ? Assume that i am running two lines of code in developer console and i want the second line to get executed only if my first line gets ...
1
vote
1answer
83 views

How to loop over all Leads in SOQL query within a batch?

I'd like to loop over all the results found in a batch job, the issue is that it seems Salesforce can only handle 10,000 at a time. I think my issue is here: global Database.QueryLocator ...
0
votes
2answers
13 views

Keep users from changing field but allow batch apex to edit it

I have a field that I want to display on a Contact record however I do not want users to modify this value. The catch is that I have a batch apex job that is updating this field periodically to keep ...