Questions tagged [batch]

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.

Filter by
Sorted by
Tagged with
1
vote
2answers
42 views

How would I use Batch apex for over 10000 records?

I understand that I need to use batch apex to do something like this and I have used it before as well, but not in the right way. I ended up making a list using an soql query for all the records and ...
1
vote
2answers
32 views

When is Database.RaisesPlatformEvents needed on a Database.Batchable?

This Firing Platform Events from Batch Apex documentation largely discusses automatically publishing a BatchApexErrorEvent on an unhandled exception: If the start, execute, or finish method of a ...
0
votes
1answer
35 views

Issue with batch class soql query returning values

I am a newbie to salesforce development of batch classes query = 'SELECT Id,Auto_close_Date__c, Status, RecordType.DeveloperName, ' + Disable_Auto_Close__c, ' + ...
-1
votes
0answers
25 views

Test Class for Batch Class not covering Formula Field [closed]

I have batch class where I am querying formula field in Start method. I am trying to write test class for it but I was not able to cover the formula field in test class. Can someone help me hoe to ...
0
votes
1answer
19 views

How to query records processed between last batch job if I'm running batch class five times a day

I want to process only those records in my batch job which are updated since the last time my batch job ran. Basically, I'm running my batch job five times a day and want to process only those records ...
0
votes
1answer
17 views

Issue with Batch Apex Updating Results from AggregateResults SQOL Query

I have an object Referral__C where we add a NHC_Tracker_ID(Nhc_Tracker__C another object). I want to update the fields on NHC tracker by count Referrals and Unique addresses related to Referral. My ...
0
votes
1answer
19 views

Batch Apex to calculate rates based on more than 50k records

I would like to calculate rates based on sets of Opportunities returned from a query -- this query regularly returns way more than the 50k limit allowed. At a high level, I know that I can get around ...
-1
votes
0answers
17 views

Need a test class for this batch class that I have written to send a report of the data of Permission license set as csv and sending emails [duplicate]

global class PsList implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { String query = 'SELECT PermissionSetLicense.MasterLabel, ...
0
votes
0answers
17 views

getting Internal Salesforce.com Error when fetching Query on ContentDocumentLInk

My rquriement is : i need to fetch all Files from Files Object . But Below my code, When i debug, getting Internal Salesforce.com Error. If i remove Files and then debug, This error is not coming . ...
0
votes
1answer
21 views

Expression cannot be assigned: when trying to use multiple if statements in a for loop

There is an object tm__c which contains LinkedIn URl(URL field),two picklist fields: Backgroundcheck(Yes, NO) and Verification(Pending, Not started, Done) I want to create a batch class so that I have ...
0
votes
0answers
24 views

Two Large Queries in Batch Apex returning at least 1lakh records each

I've two objects(Obj1 & Obj2), i will have to fetch the data in obj1. And based on the fields data in obj1, i've to query the data in Obj2. global Class batchapex1 implements Database.Batchable<...
1
vote
1answer
49 views

Dynamic Queries on Dynamic Objects at Volume

We are trying to create a mechanism that would process user dynamically created queries and create "Contributors" for each matching record. The object model is as follows: Account -< PO ...
0
votes
0answers
18 views

Debug Logs Cumulative Profiling not matching the actual debug logs

I have applied debug logs on a batch process and noticing some weird behaviour in Debug Logs. For some of the instances of debug log for execute method, I see that each method invocation to batch ...
0
votes
0answers
11 views

Visualforce component datatable duplicates rows

I have a batch class which sends out email alert first of every month. Batch class triggers the email alert using Messaging class which then uses Visualforce component to have the list of records in ...
0
votes
1answer
28 views

Why does a name change result in an invalid type?

I have two Apex classes that differ by literally only their name. Here's MaintenanceRequestBatch.cls: public with sharing class MaintenanceRequestBatch implements Database.Batchable<sObject>{ ...
0
votes
1answer
18 views

Auto Chunk Batch with BulkAPI

I'm trying to use Bulk API v1 to upsert massive Data using JSON. When I try to run the job via the standard bulk API, the next error shown up : InvalidBatch : Exceeded number of records: 10002. ...
-1
votes
1answer
22 views

Dynamic Variable Scheduler Class

I'm looking to pass a variable to my scheulder class when scheduling a batch job. The idea is that I'm scheduling the class multiple times, but passing in a different variable each time. Example: ...
-1
votes
3answers
51 views

batch apex opportunity records are not updating with compare of metadata records

Opportunity records fields compareing with custom metadata record and based on values match opportunity stagename will update but it is not working and gettin error in apex job also that duplicate id ...
0
votes
1answer
14 views

Batch Apex Error - Class must implement the following methods System.ScheduleableContext)

I am trying to update a batch class to allow me to schedule it, but I am getting this error: Class must implement the following methods System.ScheduleableContext I understand the error, but given my ...
0
votes
0answers
26 views

upsert Records using standard API and external Id

We want to give an external system the standard API to upsert records from Account Object with an external Id. The records have an associate parent Account that needs to be filled also with the same ...
3
votes
1answer
86 views

Can Database.executeBatch be called from a Queueable started by System.enqueueJob?

I'm aware that you can't call Database.executeBatch from the execute method of an already running Batchable. But can Database.executeBatch be called from a Queueable running via System.enqueueJob? I'm ...
0
votes
1answer
56 views

how to concatenate lookup fields given certain circumstances

I finished up this batch but came across an unforeseen scenario and can't seem to figure out how to code in the case it occurs. Here is my current code: global class Batch implements Database....
1
vote
1answer
29 views

confused while querying junction object

I am working on a batch and am writing a query but am getting confused because of the relationship... The batch is written on a junction object, Account_BOB__c, between 2 parents Account & ...
0
votes
0answers
36 views

Test Class of batch Apex which includes a Http Callout in the execute method

I'm stuck trying to create a Test class for my batch which execute a Http request. I tried with Test.setMock and also inserted "!Test.isRunningTest()" in the batch but nothing changes. I ...
0
votes
0answers
14 views

How can I create new lead records form a BigQuery dataset and schedule an apex job to import those datasets after every certain time?

I guess I should first implement an Apex batch class to retrieve the dataset from the BigQuery database and then execute an apex job to create the new leads records from the external data right? But ...
0
votes
0answers
11 views

How can I retrieve / read datasets from BigQuery and import them into Salesforce, in order to automatically create leads from the BigQuery tables

I need to get the BigQuery datasets into salesforce lightning app records. More specific... to be able to automatically create Salesforce leads from the data coming in real time from the bigQuery ...
0
votes
1answer
42 views

System.LimitException: Apex heap size too large: 9810745

I have a JSON too large to be deserialized, and I'm getting the Exception System.LimitException: Apex heap size too large: 9810745. I used ProjectClass= (ProjectClass) JSON.deserialize(jsonRequest, ...
-3
votes
1answer
43 views

Unable to cover test class for batch apex [closed]

I'm unable to run the test class for Batch apex. // This Schedule Class updates the Email Address of Inactive contacts whose Emp Termination date is over 30 days or Prac End date is Null global ...
0
votes
1answer
27 views

How to write batch class for :Look for contacts whose Opportunity Created Date && (Task Creation Date OR Case Creation date) is more than X years

My Batch class logic is: global class batch_update_Daily_Contacts implements Database.Batchable<sObject>,schedulable { Set<Id> ContactIds = New Set<Id>(); set<...
-1
votes
2answers
39 views

Variable does not exist - Batch Apex Query and Expression cannot be a statement

String query = 'SELECT id,Email,name,MailingCountry,active__C,ECP_Flag__c,Chrun_Indicator__c,Sales_Program_Type__c FROM contact '+' where AccountId!= null and account.Active__c='yes' and (Account....
0
votes
1answer
84 views

1 million records for Opportunity and it has Amount field, need to calculate the total opportunity Amount at end of every day and send in email

I have scheduled a Batch that will fetch opportunity values and in a static variable, it will store and keep adding them and at the end of the batch and at the finish I am sending the value via email. ...
0
votes
1answer
37 views

need help to fix apex batch test

this code not cover test for 100% global class closeAllDealsMonthAgo implements Database.Batchable<SObject>, Database.Stateful{ List<Opportunity> listRecords = new List<...
1
vote
1answer
35 views

How to conditionally control the execution of execute() method from the start() method of a batch class

I'm making a call out to get an auth token in the start() method of my batch class (I'm implementing the stateful interface and using a class variable to save this token for the entire batch ...
2
votes
0answers
42 views

Batchable Apex: Querying records that follow 2 sets of criteria in start and then doing 2 separate things with each set of records in execute

I'm writing a batch job that queries for Contact records following 2 sets of criteria and then adds them to an export object with corresponding flags of whether they fulfilled criteria set 1 or 2. My ...
0
votes
1answer
44 views

CPU time limit using Batch Apex

I am working on finishing up my Test Class to cover a new Batch Apex trigger I am writing however when I try to run the test I get the error: System.LimitException: Apex CPU time limit exceeded I ...
0
votes
1answer
58 views

Too many DML 10000 in batch apex

I have a requierment where i need to update product values daily based on product extendent values. I created a batch apex as article extended values are more. I am getting but still gettin 10001 DML ...
0
votes
1answer
34 views

Encountering Constructor not defined in test class

I'm scheduling a batchable class that deletes records from a custom object. The test class for my scheduled class saves without errors. However, I'm getting a "Constructor not defined: [...
0
votes
2answers
50 views

test class passing but not covering execute method

I have coded a batch class and am now working on the corresponding unit test. I believe I've inserted all the objects I need but none of the actual execute method is being covered, despite the test ...
0
votes
0answers
35 views

Callout Error from Batch Job

I have a batch job from which I'm doing callout to wave analytics and based on the response I'm updating one checkbox field on Account. When I execute the batch with the size of 100, I'm getting First ...
1
vote
1answer
57 views

confused with accessing variable in batch apex

Got a little confused while trying to access a variable in my batch. I update a certain field on Contact based upon the LOB field as queried for in my initial query (line 2). However, when I later try ...
1
vote
1answer
18 views

struggling to update field from a map

Having a little issue when working with a map and performing a field update in my apex code. I'm writing a batch that updates a field on the Contact object based upon a field on a custom object (lets ...
1
vote
0answers
25 views

Even with KnowledgeUser I get: Be sure the action is valid for the current state of the article, and that you have permission to perform it, exception

I have the below test class: @isTest public static void batchManagementDraftTest() { User u = TestDataFactory.createUserWithRoleLeader(); User u2 = TestDataFactory....
0
votes
1answer
76 views

Batch class start method returning null, even after a record has been inserted in the test class

I have a batch test class: @isTest public with sharing class TestBatchManagement { @isTest public static void batchManagementTest() { User u = TestDataFactory.createUserWithRoleLeader()...
0
votes
1answer
15 views

EXCEPTION_THROWN [74]|System.LimitException: Too many Email Invocations: 11

I have created the batch class to send separate email to each Opportunity owner based on their order outstanding by grouping the opportunity based on their ownership. But while executing the data am ...
2
votes
1answer
44 views

How update 120,000 Contacts which must be sorted in a specific order

As part of the Artisan Hub processing (global directory of Certified Salesforce Professionals) we need to run a daily process which assigns everyone a rank based on their total Artisan Hub points. ...
0
votes
1answer
141 views

Apex heap size too large Exception in - Batch

We have 2 objects : Order_Integration__c, Order. We are running the batch Copying order integration table data to order table. Requirement : If any error occurs while creating order. That respective ...
0
votes
3answers
43 views

I want to delete last letters of existing Contacts using Batch class. Is it possible? I want to delete all “sfdcpoint” letters

global class BatchApexExample implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { // collect the batches of records or objects ...
0
votes
2answers
25 views

Test unit for a scheduler

I have to develop a scheduler to process old registers of some object.. LastModifiedDate < LAST_N_DAYS:90 How can I create a test unit for such a scheduler? Is it possible to modify the ...
0
votes
2answers
86 views

Inserting Huge amount of Data in finish method in Batch Apex

I have a Batch class in which I am processing 10K records. The requirement is to create a file document in which all these 10K records which are processed should be listed. So, in my execute method I ...
0
votes
1answer
23 views

How To Process API Callout Response and SOQL Results in Batch

I have an existing scheduled callout which returns data that we save in Salesforce. The number of records being returned from the external webservice API is constantly increasing, so I would like to ...

1
2 3 4 5
34