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
0
votes
1answer
25 views

Batch Apex Uncatchable/uncaught exceptions

I had understanding that if batch apex execute method encounters an uncatchable/uncaught exception, then it stops the batch processing at that particular execution of execute method and does not ...
-1
votes
0answers
11 views

NPSP- Batch Apex Error Limit Exceeded [closed]

I'm new to NPSP and I have been receiving this NPSP batch error email, can some one please help me to resolve this would be much appreciated. Errors: Error #1: Error Type: Batch Apex error Error Date:...
-3
votes
0answers
23 views

Batch apex failing to create batches [closed]

We ran the batch apex to process about 16000 records and see that batches are not getting started / processed at all. I have checked in the apex jobs several times, and there are no batch jobs getting ...
1
vote
0answers
24 views

How to update records which also are updated by by batch process

We currently have a batchprocess running from a managed package which runs every day for almost the whole day to update records of an object. When a user tries to do an update on this object we have a ...
0
votes
0answers
26 views

Transform an apex action (invoked in flow) to a batch [closed]

I need some help on transforming an apex action (invoked in flow) to a batch. I have multiple input parameters from the flow, i do some SOQL queries, functions and DML operations for many objects (...
0
votes
0answers
72 views

what is best way to make Apex callout asynchronously? [closed]

I need to make an Apex Callout from salesforce to 3rd party website. This process needs to run once or twice a day. As this is not real time integration, and data can be large, so decided to go for ...
-2
votes
1answer
43 views

write a batch class for updating the Age of contact in a custom field

I have proceeded this way to get the age by decrementing the year of birthdate from current year.Is this the right way? global class AgeInputBatch implements Database.Batchable<sObject>{ ...
0
votes
0answers
9 views

Lightning Flow event subscription is working for one record(not for bulk)

I am using a simple Lightning Flow to subscribe the platform events. The Lightning flow invokes apex action. I created a batch apex and for each record in the scope I am triggering the platform event. ...
0
votes
1answer
58 views

Batch class for deleting child record when parent record is deleted

I have written this code for deleting child records when parent record gets deleted. But when i execute this i dont get any error nor the records are getting deleted. Kindly help me where i have done ...
0
votes
0answers
21 views

In a flow Scheduled batch is there a way to do a subquery for results?

Normally, I would create an apex batch class and do a subquery to get the results I need. For example select id, groupid, userorgroupid from groupmember where userorgroupid not in (select id from user ...
-2
votes
1answer
55 views

AsyncApex Scenarios [closed]

I am writing a few Ques for which i have found conflicting answers on Internet. Also I have written my Answers after researching on Internet, but wasnt 100% sure, hence posting these here to clear ...
0
votes
1answer
30 views

Getting Multiple times output

In this batch Apex code, I updated Mr. infront of the name if student is Male and Mrs. infront of the name if student is Female but at in output Mr. or Mrs. is getting multiple times. Please give me ...
-2
votes
1answer
36 views

Calculate discount

In this batch apex class i want to apply discount to the students. If student is male then we can apply discount 10%. If student is female then we can apply discount 20% The above is the code that i ...
3
votes
1answer
64 views

Rest API query with FIELDS() does not return nextRecordsUrl

Goal: Get all Account records with all fields via REST API Approach: Send GET request with query: /services/data/v53.0/query?q=SELECT+FIELDS(ALL)+FROM+Account+ORDER+BY+Name+ASC+LIMIT+200 Problem: I ...
0
votes
1answer
30 views

How to create a batch to count the worked days of the users based on LoginTime

I need to create a batch to count the worked days of the users based on LoginTime, excluding only the weekends (Saturday & Sunday), but I'm quite new in the programming area and I have been ...
1
vote
1answer
24 views

Batchable class which publishes events... test assert not working?

I have a batchable class which updates a record, then publishes an event. To write a test which ensures the "publish" occurs, I've created a fake instance of the class which normally ...
0
votes
1answer
24 views

Apex Debug logs not showing Statement executes

I am trying to run a batch class from anonymous window. In the debug logs i am not getting the statement executes. Only method entry/exit is showing. Debug level for apex is set to finest. It keeps ...
0
votes
1answer
108 views

How to process large volumes of records with callouts?

My client needs to import PDFs from Dropbox, match them to an invoice (where filename without suffix = field reference on invoice object), and attach to the appropriate invoice, then move the Dropbox ...
0
votes
0answers
22 views

Apex Batch that Calls a Vlocity Integration Procedure

I have a batch apex that executes a Vlocity integration procedure for every record in the loop. I'm facing the problem of 'First error: vlocity_cmt:Too many SOQL queries: 201' Do you have any idea ...
1
vote
0answers
48 views

How to fix System Error : Duplicate Id in list in Batch Apex

I have an error Duplicate Id in list when executing my batch. I looked at different answers on the community but even when trying to implement them, I still can't fix my error. To try to fix the error,...
0
votes
1answer
29 views

transient List of Database.Error becomes null in finish

I have a list to to accumulate All dB Errors, I need to use that list in finish. But the transient variable is null in finish. Here is My class: global class BatchToDoSomething implements Database....
0
votes
2answers
69 views

How to increase code coverage for batch apex test class?

I have created test class for batch apex but it only covers 36% of code. How do I increase the coverage? Below is the test class that I have created. @isTest public class CloseOpportunityBatchTest { ...
0
votes
2answers
32 views

I am getting FATAL_ERROR System.QueryException: unexpected token: StageName

I'm writting a query in a batch like this : public Database.QueryLocator start(Database.BatchableContext bc) { return Database.getQueryLocator( 'SELECT Id, StageName, Closing_Reason__c, ...
0
votes
3answers
41 views

Batch Apex to auto-close opportunities if stage is Imported and 60 days after Action_BY_Date__c

I want to auto-close all the opportunities 60 days after Action_By_date__c and Stage is Imported. Opportunity must be closed by system where Stage = System Closed and Closed reason = Expired. When I ...
0
votes
1answer
48 views

Calling Flows from Batch Apex and making the Flow.Interview Class Bulkified

I am running a scheduled batch job daily on 25,000 records and growing. I Want to be able to leverage Salesforce Flow for processing the data because it gives more control to the Admin for ...
0
votes
0answers
24 views

Mass re-rerun / re-evaluation of related records

I have an object called Journey. Each record of this object is made of several Steps(object) and Sub-Steps(object). To create a Journey record, I use a Template (Journey Template object). When adding ...
0
votes
1answer
30 views

Schedule Apex not working properly

I have a batch that schedule a job for the next hour but in my Production environment is scheduling it for the following month. public void finish(Database.BatchableContext bc) { Datetime now = ...
-3
votes
1answer
53 views

Salesforce limit for concurrent calls of Async Apex

What is the limit of max concurrent calls for Batchable apex Queueable apex Future methods Need the Limit for both the scenarios 1. Limit for running the same batch (with different transactions), 2. ...
0
votes
0answers
40 views

Scheduler: failed to execute scheduled job: AsyncApexJobObject, reason: You have exceeded the maximum number (100) of Apex scheduled jobs

I have implemented is a Schedulable Interfaced class, which I have scheduled to run every day at a certain time. In a nutshell, it runs a for-loop inside which, I use: system.scheduleBatch method to ...
0
votes
1answer
39 views

Query 50000 records in apex class and have processing on it

I need to fetch around 300,000 accounts in my apex rest class and then work with them. I tried using aggregate to reduce the records but aggregate takes up alot of time. As mentioned, it is a rest ...
1
vote
1answer
41 views

Bypass/deactivate validation rules, workflow rules, process builders in apex class

We are writing batch job to update a field one of object records through batch(around 500K records). I have validation rules, workflow rules, process builders on this object which increases the batch ...
7
votes
1answer
325 views

What is the reason that salesforce introduced Mixed DML Exception?

I attended an interview in the past and some questions really left me wondering why salesforce behaves the way it does. I am seeking answers to these questions, mostly every blog talks about how to ...
0
votes
2answers
25 views

In a batch class when deployed to org getting error- Missing return statement required return type

My requirement is based on mode value passed I need to get the records based on a specific record type value. Below is the sample code. Getting an error- 'Missing return statement required return type'...
-1
votes
1answer
37 views

Batch Class when parent is created then child should get created

I have requirement When account is created then contact should get created and linked to that particular account. Can we write batch class for it, i have written a Batch with Trigger trigger ...
1
vote
1answer
45 views

Scheduler is using previous version of Apex batch

[Step to Reproduce] Create a new Apex Batch. Set a Scheduler for the Apex Batch. Update the Apex Batch. => Once the scheduler runs, the scheduler still using previous versions of Apex Batch. The ...
0
votes
2answers
48 views

Queuable Apex callout

Requirement is to loop through set of records(could be in 1000's) and make a REST callout to process those records. I did went through multiple Q&A posted in the community but still stuck with it. ...
0
votes
1answer
28 views

Update Lookup field based on a matching value in another field

Very new to apex and hoping someone can guide me on the best way to approach this problem Object: ObjA__c - Field: LookupToObjB__c (lookup) (field to update) - Field: JobNumber__c (string) Object: ...
1
vote
1answer
224 views

Can I define the order when using two batches in the Schedule Class?

public class ScheduleOnProjectSum implements Schedulable { public void execute(SchedulableContext SC) { DeletedSBLBatch dsb = new DeletedSBLBatch(); try { ...
0
votes
0answers
29 views

Scheduler is unstable, the behaviour is weird

[Background] I have 3 daily scheduler The scheduler is scheduled at 8am, 12pm, 6pm All of the scheduler run same Apex class The process of Apex class is selecting some records and copy over to ...
0
votes
0answers
20 views

How to create a new schedule with Batch with Contructor

Currently, I have in my org this code below, it runs several times a day it calls an API that tracks the shipment. The problem is that I need to create a new Schedule for a new type of shipment. The ...
0
votes
0answers
27 views

SOQL Query to get version data from ContentDocumentlink object while running in batches via API

I was trying to get VersionData from ContentDocumentLink Object directly in one SOQL query instead of working on two seperate queries in a batch via API. was trying this SELECT Id, (SELECT ID, ...
0
votes
2answers
166 views

Parent to child creation using batch class

I have written a batch class where when parent is created then child get created and relate to it. But when I manually create the parent record, child record get create in bulk. I want when one parent ...
1
vote
1answer
74 views

Using metadata in formula in Apex

I was working on a bank management App. and as a feature, I created a batch that is supposed to do a deposit regularly every three months. And the requirement was that I use a custom metadata for the ...
0
votes
1answer
65 views

How can I resolve batch chaining issues from a managed package?

Got a triggerhandler class that creates a collection of things and passes them over to Batch Apex for processing. That batch handler, in it's finish method, then hands off to another batch class. ...
0
votes
1answer
25 views

Scheduling Scheduled Job from Managed Package

I want user of the managed package to be able to run a scheduled job that repeats every hour. The Scheduled Batch class is from the managed package and I'm having trouble accessing it when logged in ...
0
votes
2answers
78 views

Batch Apex: start multiple Batch Apex concurrently

I have a custom Object (Bulk Order) and a child (Bulk Order Line). I have a trigger on Bulk Order object to call a batch apex when Bulk Order record status is = 'In progress'. My question is: Imagine ...
3
votes
2answers
346 views

Batch Apex -- Constructor Not Defined

I've read through some other similar posts, and what seems to usually throw this error (Ex: constructor takes 3 args and you've only given it 2) I don't think is the case here. My constructor only ...
2
votes
1answer
363 views

How can I schedule a batch for every 2h (to run at half past?)

How can I schedule a batch every 2h (to run at half past?) like.. 00.30, 2.30, 4.30, 6.30, ..... 20.30 Thanks.
0
votes
1answer
25 views

Queries on batch execute

I still don't know if queries in execute batch are made for each record or batch execution. For instance: global void execute(Database.BatchableContext BC, List<xR1_order__c> scope){ ...
-3
votes
1answer
35 views

Batch apex : Frist error Apex CPU time limit exceeded [closed]

I am getting CPU time exceeded error for my batch class. I have 187,000 records to query on and I want to delete all the records. I am using below query in start method. global Database.QueryLocator ...

1
2 3 4 5
37