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
0answers
22 views

How to write a test class for this Batch covering all scenarios [duplicate]

I am writing a test class for following batch, but code coverage is not increasing more than 28%. Can anyone please help with the test class for this batch. global class CaseOwnerManagerUpdate ...
1
vote
2answers
100 views

Unable to escape the governor limits (Too Many SOQL Queries: 201)

My governor limits are getting exceeded because i need to use count() for each individual fieldName and check fieldName != null, and return it's individual value But there are over 300 fields, how to ...
0
votes
0answers
35 views

Batch file to replace ,comma from csv with blank value [closed]

I have a very big csv file which have few comma's. I am trying to create batch file which will replace the comma with blank value. I tried below code but and it is removing comma but not replacing it ...
0
votes
0answers
39 views

Chaining of Batch getting counted against API Requests, Last 24 Hours

This is strange for me and a new information to me. But calling a batch or recursively calling a batch is contributing to API Requests of org. I did test this in my own dev org, where no external ...
0
votes
0answers
21 views

How to catch exception if flexQueue is full when using System.scheduleBatch

What happens to a batch class which is scheduled to be executed by System.scheduleBatch(batchableClass, batchClassName, 1, 50); The batch class gets scheduled as a Schedulable Job after a minute. ...
0
votes
1answer
23 views

What is the 'SFDC_Devconsole' debug level?

I am trying to retrieve error logs for a batch apex class and am creating a new user trace flag for the running user. The standard preset is 'SFDC_Devconsole' - will this trigger debug logs to show ...
0
votes
1answer
35 views

Batch class to update a lookup field on CASE Object

I am new to Salesforce development. I want to write one batch apex which will look into user object and see if manger field is getting updated for User record, then it will update user manager for all ...
-1
votes
0answers
12 views

how to send an email in every 48 hours to approver that he/she has pending this much bulk of request to approve/reject [closed]

Requirement is need to send an email in every 48 hours to approver that he or she has pending this much bulk of request to approve or reject of new opportunity using existing approval process.so what ...
0
votes
1answer
29 views

If batch class and trigger will fire at the same time and update the same record, will there be any conflict?

I have a trigger written on before update of account that whenever a check box field on account object is updated from false to true, then I am doing some actions on the related cases. We have a daily ...
2
votes
2answers
80 views

Question about QueryLocator limit in Apex code

I was investigating Batch Apex recently. I been little confused by Salesforce document about QueryLocator limit. In "Execution Governors and Limits", it said: "Total number of records ...
2
votes
1answer
59 views

How to get batch count for a Bulk API v2 Job?

Looking at Bulk API 2.0 and Bulk API Developer Guide, I did the following: Create a job Upload Job Data Closed Job I am now interested in knowing how many batches have been created for the job. The ...
0
votes
1answer
49 views

REQUEST_RUNNING_TOO_LONG :Your request was running for too long, and has been stopped

I have created a Batch which is supposed to pull Completed tasks and Reopen them. It's a simple implementation (code attached), but what i observe is the Query is taking too long and ultimately aborts ...
0
votes
1answer
24 views

Informatica job failing with UNABLE_TO_LOCK_ROW:unable to obtain exclusive access to this record or 1 records: 001

Our Contact model is Private and there is a relationship with the Account object but it is a Lookup and NOT Master-Detail. We also have a custom setting which makes sure that not Triggers are running ...
0
votes
2answers
37 views

Batch Class Question

I am trying to do a mass update of all account email fields to "testing.com" however I am getting an error message saying my variable does not exist. This is my class. global class ...
0
votes
1answer
54 views

How can I track the moment when a new object field is added in a batch class?

I have a batch class: public class DataValidation implements Database.Batchable<sObject>, Database.AllowsCallouts{ private List<String> missingDates; public ...
3
votes
1answer
44 views

Apex Sharing - With Sharing Batch class execute from object trigger

From Apex trigger the batch class is executed which has With Sharing keyword. And inside the Batch class, there is a record delete statement without a CRUD check. Currently, a user who doesn't have ...
0
votes
1answer
30 views

Database.stateful not maintaining state

I'm trying to use Database.stateful interface in one of by batch to perform some action on list of AccountIDs and i want to keep track of the Accountids for whom action has already been performed in ...
0
votes
1answer
31 views

How do I modify this part of code to avoid 'Too Many SOQL'

I have the following SOQL inside a For loop in a batch class that checking the SUM of each vendor with specific Expiration Date. vdrWithExpiryDates is a map that store different expiration date for ...
0
votes
0answers
16 views

Big Objects - How to Retry a Batch?

In exploring Big Objects the docs state the below: When working with big data and writing batches of records using APIs or Apex, you can experience a partial batch failure while some records are ...
1
vote
1answer
47 views

Understanding Batch Apex / Callout performance

I am looking for some advice regarding the optimization of an Apex Batch which is behaving quite differently in UAT and PROD environments. In our ORGs we have a Batchable process that is responsible ...
0
votes
1answer
26 views

How Can A Batch Transaction Be Executed From A Nested Loop To Update Variables In The Outer Loop?

How can we update a variable in an outer loop from a Batch transaction in an inner loop? For example, consider a example scenario where you must track the even Apples (per Basket) inside multiple ...
-2
votes
1answer
33 views

create @InvocableMethod inside class that implemented Batchable and invoke new instance to start

the main idea is to invoke @invocableMethod from flow and start Batch without creating separate class to be able to start batch
0
votes
1answer
44 views

Start batchable from Scheduled flow

Is it possible to start a batch from a Scheduled Flow? Or do we need to implement a separate Apex class with an invocable action and call that action in the flow? I have a batchable with a custom ...
0
votes
1answer
37 views

Insert record in related child object only if size of related object is 0

I am trying to insert record in related child object but only if size of related object (Comment__c) is 0. Means there should be no records in relate child object. I have done the implementation but ...
0
votes
1answer
18 views

Does it make sense to use ORDER BY clause when it comes to batch `start()` method

Could anyone explain more what Batches of records tend to execute in the order in which they’re received from the start method. However, the order in which batches of records execute depends on ...
0
votes
0answers
72 views

Map doesn't structure itself properly

My map structure should be something like this : slfMap : Id of mainPax n°1 ==> {{Sobject[] of mainPax N°1}, {Sobject[] of PaxlinktothemainPax N°1}, ...
0
votes
0answers
30 views

“Internal Salesforce.com Error ” (FATAL ERROR) During a Batch class run on creation of opportunity products

We have created a Trigger on Content Document link Object which has a handler class which in turn calls a batch class. The process is when a user upload a csv file it will create opportunity product. ...
0
votes
1answer
29 views

Could you help me my find whats wrong with my code. Thank you

global class Batch_example_1 implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database.BatchableContext bc){ //fetch all the accounts String query='...
0
votes
0answers
48 views

Batch that does not update record, Duplicate Id in list

Alright, I've made progress, but I still get a fatal error on line 220 01:26:29:088 FATAL_ERROR System.ListException: Duplicate id in list: a0D1X000003tQ2IUAU FATAL_ERROR Class.PRG_MAJ_Total.execute: ...
-2
votes
1answer
21 views

How to convert set of string to string so can set values to Multi Select picklist

Here is my use case: I have two multi select picklist values from two objects Pickist A : Apple, Orange Picklist B : Apple, Orange, Banana I did create two sets and compared two picklist values. Now I ...
0
votes
0answers
50 views

Batch Apex Class with HTTPCallout to Insert New or Update existing records

I'm struggling to make this work. I'm a very beginner developer and really need some help. I need to connect to an external system, get the Contacts from a list and create new Leads in Salesforce. In ...
1
vote
1answer
67 views

API calls in batch class's start method [closed]

Can we make API calls in 'start' method of batch class ?
0
votes
1answer
29 views

Sending large batch of emails with a specific email template using REST

Currently: I have a REST call to SaleForce Marketing Cloud that sends an email with a specific template/definition key and a set of attributes. This is good for sending an email when triggered by our ...
1
vote
3answers
176 views

using today date in Database.getQueryLocator query String throwing errors

I am running a batch class. I am providing query in string format. I am facing issue with using a filter criteria StartDate__c>=:System.today() In a direct query, i could write something like List&...
0
votes
2answers
65 views

Batch job chunks calling queueable jobs transaction limit

This is a basic question instead of code related. I am writing a batch job which will update Application__c records. Trigger for Application__c object, enqueues a queueable job to update cases Batch ...
1
vote
2answers
124 views

Order of constructor execution for a class that implements a batchable as well as scheduleable interface

I am writing a batch class which should be scheduled to run at a certain frequency. I am putting both interfaces on same class - global with sharing class testbatch implements Database.Batchable<...
0
votes
1answer
17 views

Suppose I schedule a Schedulable batch job and my profile is “API User” and then it upserts

Suppose I schedule a Schedulable batch job and my profile is "API User" and then it upserts and a trigger runs to insert/update records. In whose context it will run? Who will show as "...
0
votes
0answers
29 views

Batch error : System.LimitException: Too many SOQL queries: 201 [duplicate]

I have this error when I run my batch "FATAL_ERROR System.LimitException: Too many SOQL queries: 201" even when changing the batch size to 10 ?! I know I need to remove the SOQL queries from ...
-3
votes
1answer
73 views

“First error: Apex CPU time limit exceeded” in Batch Apex

I have a batch apex that is facing the error "First error: Apex CPU time limit exceeded". This batch is collecting account records based on some conditions and then trying to group them ...
2
votes
1answer
25 views

Public variable appears empty in the test method of a test class

I am trying to get the value of the variable "listAccountsTest" in the "static void test" method. This variable will be used in the "System.assertEquals" method as the ...
4
votes
1answer
201 views

executeBatch method returning invalid id 000000000000000

One of our client is seeing this issue in their production org. Following is the line where this issue is occuring : ID batchId = Database.executeBatch(MainBatch); This line is throwing System....
0
votes
1answer
26 views

is it possible to write an algorithm in zbase32? [closed]

I have a request to generate unique codes through an algorithm. take a unique number from a sequence (maximum value 2 ^ 30) ZBase32 encoding is used to encrypt the number. The encoding alphabet is as ...
0
votes
1answer
36 views

Catch error in scheduled batch

I want to catch here an error on deleting records. but i dont really understand how? Can u help me please? public with sharing class AccountTest implements Database.Batchable<SObject> { ...
0
votes
0answers
25 views

How do I test static variables using Database.Stateful across batch runs

I am using a class that implements Database.Batchable<sObject>, Database.Stateful and I need to test it. In the finish() function, I generate and store some records based on information ...
0
votes
0answers
19 views

Add record to object wiith and check errors with platform event

I cannot find the information I need about this. What i am trying: Add some records to Account object with Batch and checking errors if Platoform Event. So if records added i want to write in platform ...
0
votes
0answers
159 views

REST API call in batch APEX

In after insert trigger of account I need to call a rest API and have to post the data. I did this by creating a normal APEX method and doing the call out. But in some where I saw that even if we post ...
0
votes
3answers
113 views

Rollback all data created in the apex batch

I have implemented the batch which is executed from apex controller. Now, if one job of the batch fails (due to some exception), I need to rollback the changes not only for that job but for all the ...
2
votes
1answer
40 views

Query_more behaviour when the data is modified during execution

I have a pretty slow operation to apply to a large number of records (1.5M+). All these records have not be modified for more than six months. To get these records I use api calls query() then ...
0
votes
0answers
16 views

Authsession values not coming in scheduled batch job

List<AuthSession> lstAuthSession = new List<AuthSession>(); lstAuthSession = [SELECT Id, SessionType, UsersId, UserType, NumSecondsValid, IsCurrent, ParentId, LastModifiedDate FROM ...
0
votes
1answer
16 views

does testing batch class affect non test data

I have a question, I'm making a test class for a batch. This batch deletes custom objects depending on the date (for example, the constructor receives an amount of days, and the batch deletes all ...

1
2 3 4 5
36