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
-2
votes
0answers
30 views

Execute Apex Class from custom button

I am sorry if this is recurring question, I tried to find an answer for myself but I could not find the best one for me. So, my question is does anyone know how to call batch class from a button I ...
0
votes
0answers
19 views

Batch Class creation from parent to child

I have written the batch class But its not working pls help on below - Parent is Tour__c and child is Leasing_Tour_Email_Queue__c, When Parent is created then child also get created Criteria :- ...
0
votes
2answers
38 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
votes
0answers
19 views

REST API or BULK API to process contacts from external system

this question is more around solution design rather than dev issue, but our team is new to API integrations an need some guidance. In our company SF is not a source of truth for Contact data, it is an ...
1
vote
1answer
53 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
53 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
13 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
41 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
158 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
159 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
22 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
28 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 ...
0
votes
0answers
48 views

How can I make delete trigger run only once for all deleted records?

I must run two Batches after Case records are deleted. The problem is that records enter the delete process one by one UPD: if you delete records from SOQL or multiple records from the UI. Therefore, ...
0
votes
1answer
29 views

Can't create a Contact John Doe to related Account passing ID, any suggestions?

global with sharing class JohnDoeBatch implements Database.Batchable<SObject> { //Start method global Database.QueryLocator start(Database.BatchableContext bc) { String query = '...
0
votes
1answer
120 views

How to retrieve multiple objects records in the Batch Apex execute method?

I need to wrap records from Opportunity, Account, Quote, User objects. I need help with Batch Apex execute method. how to retrieve those records and wrap them with the wrapper class on execute method. ...
0
votes
1answer
43 views

How to avoid calling a method with soql inside loop?

I am writing a batch class in which I am calling my custom-defined method inside for loop. But the main problem is my custom-defined method executes a soql query which means it's a bad idea to call it ...
-2
votes
1answer
37 views

Variable does not exist: CurrentElement in batch class

I'm trying to insert data from standard FlowInterview object to Custom object. But it is throwing error like below for all fieds mapping. Below is my code public class FlowInterviewHandler implements ...
0
votes
2answers
54 views

Sytanx errors: Create Batch Class to Process Stagings and insert Opportunity

I am working on a task. To understand my issue let me describe what I am doing. Object: staging__c Fields: Individual_or_Organization__c (Text) Orgganization_Name__c First_Name__c Last_Name__c ...
0
votes
1answer
96 views

Batch Class Error - System.UnexpectedException: Start did not return a valid iterable object

I m trying to Sync Salesforce with an external system and run the batch class every night but when I try to test the batch class in Execute anonymous window, I get this - System.UnexpectedException: ...
0
votes
0answers
29 views

Batch Job causing an error in FSC [duplicate]

I wrote a visualforce page that launches a batch job that processes records in batches, the batch creates households, person accounts, and then financial accounts for Salesforce Financial Service ...
0
votes
0answers
27 views

Batch rest callout error handling

I have some batch which making a post request with token and i want to handler error. Its easy to handle execute method, but can i handle errors in start with getQueryLocator?Also how can i handle ...
0
votes
1answer
27 views

Is that possible to call batch class from trigger for more than 2K records to do callouts?

We want to do call to batch apex from trigger. And in that batch apex class we want to do callouts. So we are giving batch size 50 in scope parameter. but we have more that 2K records which we update ...
0
votes
1answer
36 views

Why my test class is not covering execute method?

Class: global class SendNewAccountEmailBatch implements Database.Batchable<sObject>, Database.Stateful { List<string> sendingTo; EmailTemplate mailTemplateRcd; global Map<...
2
votes
1answer
63 views

How is the Start method from Batchable Interface able to return two different return types? Iterable or QueryLocator

How is the Start method from Batchable Interface able to return two different return types? Iterable or QueryLocator. As far as Function Overloading is concerned, methods can be overloaded based on ...
-2
votes
2answers
58 views

Getting 'First error: Attempt to de-reference a null object ' error on Batch class execution

My batch is running without any error in lower environment, but when I scheduled batch apex in Production, it shows this error :First error: Attempt to de-reference a null object. I have tried to use ...
0
votes
0answers
18 views

Post request with records to another org scheduled batch

I am making a post request to another org with custom object records. I have created boolean field to mark needed records and transsfer them though batch. That field changes in Trigger on create and ...
0
votes
2answers
36 views

How do I update map's value with each new batch apex

I have this batch class with many records that gives the count of records associated with each fieldName. Now Iam trying to insert those fieldName and count values as a new record in a custom object. ...
0
votes
2answers
29 views

Batch apex: Are individual transactions (execute methods) run in serial?

I have spent few hours today to understand this as this was not clear from documentation. Also, the test seems to say that my understanding is wrong. So, wanted to verify with the community. So, ...
0
votes
0answers
52 views

Query in Batch Apex returns "List has no rows for assignment to SObject" [duplicate]

I have test class where I am using a csv file to insert 200 records Account data. First 100 are like: remaining 100 are like: I am using above created test class to test a batch apex class which has ...
0
votes
2answers
47 views

Does Database.QueryLocator and Iterable both have same limit?

I wrote a batch class to insert dummy data into big object and have used Iterable to insert data. I was under impression that Iterable should only be able to insert in normal limit of 50K records. But ...
0
votes
1answer
56 views

Merge identical records with batch apex, turn not identical fields in said records into a multipicklist

I'm a novice and this is my first post here so I apologize if im doing this wrong I have a requirement where i need to use batch apex to: Merge records with the identical fields "Name" and &...
0
votes
2answers
107 views

Batch apex with no query in start method?

I have a method in an Apex class which is used in a visualforce page. I have been asked to move part of the method's code in a batch, since it seems that it is exceeding limits and causing errors. ...
0
votes
2answers
62 views

Apex Limit for trigger

i have a problem. I get 200,000 records and I have to perform some logic via trigger. the trigger at each insertion executes a query. Can you give me some advice on how to do this without exceeding ...
0
votes
1answer
24 views

How to merge duplicate contacts in one contact which was created first by using batch apex

How can i merge duplicate contacts under original contact. Orginal Contact : The contact which was created first is an original contact And we have to merge all duplicate contact in that original ...
-3
votes
1answer
49 views

Need help with the Test Class for following Case Object Batch Class

I am new to Salesforce coding and trying to write my first test class. I have tried all day but can not get any coverage for this batch class. Can anyone please help me with the test class for this ...
0
votes
0answers
25 views

Unable to get code coverage for the test class for following Batch class on Case Object [duplicate]

I am new to Salesforce coding and trying to write my first test class. I have tried all day but can not get any coverage for this batch class. Can anyone please help me with the test class for this ...
0
votes
0answers
29 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
115 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
45 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
25 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
38 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
98 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 ...
0
votes
1answer
36 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
128 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
186 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
111 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
52 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
40 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
56 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
88 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 ...

1
2 3 4 5
36