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

test class this batch with Trigger [duplicate]

Sorry how can i create a test class for these related classes? batch code : global class CreateRicontatto implements Database.Batchable<sObject> { String campaignId; global ...
user avatar
  • 1
0 votes
1 answer
23 views

Variable does not exist: Apex Batch

I am newbie in Apex, but I am trying to write some code. The purpose was simple: I have PricebookEntry object on Salesforce, and 2 lookup fields: Pricebook2Id Price_Book_2__c I want to fill ...
user avatar
0 votes
1 answer
22 views

Batch Apex: class executed multiple times at once?

I have a batch apex class, and this class makes a SELECT with a limit of 1000. after that, this class creates one campaign using insert, and processes others things, whatever. the question is when I ...
user avatar
0 votes
1 answer
42 views

Getting content from within triggers is currently not supported

I am sending a pdf in an email when the opportunity is created on updated which works fine. Now when the opportunity is created through batch so its throws the error future method can not call future ...
user avatar
  • 3
0 votes
0 answers
40 views

Batch test class passing but not covering execute method

public with sharing class ContractBatch implements Database.Batchable<sObject>,Database.Stateful{ public Database.QueryLocator start(Database.BatchableContext BC){ return Database....
user avatar
  • 1
0 votes
2 answers
40 views

Batch class run after press button

I need to create a batch that automates the creation of Cases from a Campaign by taking only the members related to a campaign that are in 'To send' status. (this batch should run after pressing a ...
user avatar
  • 1
0 votes
2 answers
37 views

Triggering cleanup job after multiple batch jobs

I have a series of regular maintenance batch jobs that aren't dependent on each other and are triggered by a user. For example Clean up accounts Clean up contacts Clean up leads The list of items ...
user avatar
  • 1
-2 votes
0 answers
43 views

Batch class to upsert the record

Edited - I am upserting records with external id ssn so how should i put my ssn in failureIdsSet so that I can call the failureIdsSet in email alert. I have a batch class which I use to upsert records ...
user avatar
1 vote
1 answer
40 views

Add value to multi-select picklist with batch class

I'm trying to add a value to a multi-select picklist with a batch class. The debug statement shows that its being added but it's not saving for some reason. Any ideas? public class ...
user avatar
3 votes
1 answer
216 views

Salesforce Flow Limitations - Loop vs Batch Records

I have recently been digging into salesforce flows. I created quite a large flow (basically a series of subflows). It all worked as expected, and was based on when one of my objects was created or ...
user avatar
-1 votes
0 answers
10 views

To send the hyperlink of inserted contacts and opportunity of the record page to the email using batchapex.I am unable to get the hyperlink

global class DemoBatch implements Database.Batchable <sObject>,Database.Stateful { global final String query; global final Integer con; global final Integer opp; List<...
user avatar
  • 1
-4 votes
0 answers
13 views

Want Test class for below class [duplicate]

global class WebAdmitDailyJob implements Schedulable,Database.Batchable,Database.AllowsCallouts { global void execute(SchedulableContext SC) { Database.executeBatch(new WebAdmitDailyJob(),...
user avatar
0 votes
1 answer
12 views

LeadHistory NewValue Field Print Different Values

I wrote a batch class on LeadHistory Object. So in my sandbox when we debug the LeadHistories value then it will show the Name of the User/Queue in NewValue for ownerAssignment.Below is the Debug log ...
user avatar
-4 votes
1 answer
43 views

Apex passing parameters to Batch job during scheduling [closed]

I need to pass the query to the batch class while scheduling it. How could i send the query as a parameter from the schedule class to batch class?
user avatar
0 votes
2 answers
43 views

Change the format of all Contacts phone numbers to 1234567891

Some of the phone numbers of Contacts are formatted as (123) 456-7891 I need to change the format of all phone numbers to 1234567891. I don't want to create another formula field that contains the ...
user avatar
  • 37
0 votes
1 answer
64 views

batch class to update the field after record insertion

I have one custom object(Import__c) where I am dumping all the records through data loader and runs a batch class to query the Import__c object and create respective records in another object (...
user avatar
2 votes
1 answer
68 views

Batch apex not executed from test class

I made batch class, and It's working very well. But when I try to execute it in test class, Batch apex not getting executed from test class, and it does not see test data. I've made two versions of ...
user avatar
1 vote
0 answers
36 views

Mysterious "System.QueryException: Truncated" error being thrown in batch job

I am an ISV provider and our managed package is experiencing this error in a batch job in a subscriber org. I cannot find any information on what it means. Oddly, debug logs on this error do not yield ...
user avatar
0 votes
0 answers
23 views

Unable to Run Batch Test Classes. Please help me [duplicate]

I have written Batch Class which is working fine (batch class is written below), now I want to write its test class. The one I have written is not giving 100% code coverage (only 30% is covering), it'...
user avatar
0 votes
1 answer
50 views

Monitor Bulk Data Load Jobs Remain "In Progress" even when there are no more batches to complete for the job

As the title suggests, I am loading data into Salesforce via the Python Simple-Salesforce Library. For some reason, the jobs that are fully complete, are still showing up as "In Progress". I ...
user avatar
3 votes
1 answer
334 views

How to approach a very complex Batch class?

I am struggling with finding a blueprint (or a solution) to a batch class that would be run every 1-2 days and recalculate a checkbox on Event records which were updated within the last 2 days. Any ...
user avatar
  • 33
1 vote
0 answers
26 views

BatchApexErrorEvent not logging error

I just created a simple batch that gives custom exception when specific condition are met. I am using BatchApexErrorEvent for logging the some random value in account object Phone field to verify how ...
user avatar
0 votes
1 answer
30 views

What are cons of running a batch a few times a day?

Running a batch is needed because people want to see results from the batch in the same day. Now our batch runs every night Are there any issues (for example performance issues) of running a batch ...
user avatar
-1 votes
2 answers
30 views

squery not fetching the values in the batch class [closed]

need some help for the batch class as i am not able to print the sQuery values in the batch class, not sure what is the correct way to do this one. kindly some one help me for the correct sQuery in ...
user avatar
  • 11
0 votes
1 answer
84 views

Prevent Duplicate records on object in salesforce during batch job and keep running

Ok the situation i have is I have a nightly batch job that reads all picklist items and then puts them into an object so we can offload them to a data warehouse If the item already exists (combo of ...
user avatar
  • 415
0 votes
2 answers
165 views

No more than one executeBatch can be called

I've writtem a test class for my batch class. I've followed everything that was described in this question. Still getting the same error. Can anyone help me to find the problem in my code? System....
user avatar
  • 35
0 votes
1 answer
33 views

429 status code if I make call outs in Batch execute

From a batch apex I am trying a make a call out in for loop as like below for(eBilling__c bill : lstBilling){ try { HttpRequest req = new HttpRequest(); ...
user avatar
  • 59
0 votes
0 answers
66 views

Error too many rows 50001 in a custom Rest API

I have a custom rest API that when is called from a third party system (this third party system calls me providing a country code like UK, DE, US... and some other parameters) I filter account object ...
user avatar
  • 1
0 votes
1 answer
97 views

Test coverage for finish method in Batch Apex with a chain class

I wrote a test class for a Batch Apex Class that has a chain of another class in the Finish method. I tried the following approach, but it still does not cover the lines in the Finish method. Is there ...
user avatar
  • 35
0 votes
0 answers
30 views

Best possible way or best practice to get the count of distinct records if more than 5 million records are there in Object

I have a custom object with master detail relationship to Account and lookup relationship to contact. what is the best possible way to get the count of distinct contact records grouped by account. I ...
user avatar
1 vote
0 answers
47 views

Scheduled Job Is Not Running

I have written a REST API request that passes the response body to a class to deserialize it into a wrapper class. That rapper class then passes a list of records into a batch class incrementally so ...
user avatar
  • 13
-1 votes
1 answer
40 views

Getting error(TestMethod do not support Web service callouts) test class is failing because of the existing trigger on Job__c which making callouts

Not able to cover only Email messaging part in Execute method in batch class coverage is 62% Any help will be aprreciated. Batch class- global class SendEmailJobsAlertBatch implements Database....
user avatar
-1 votes
1 answer
115 views

Compare 2 datetime in Apex batch class

I have below query where i need to compare datetime custom field with system.now. Currently my timezone is australia/sydney,which i need to consider, I tried many combinations but getting Invalid ...
user avatar
  • 1
1 vote
0 answers
45 views

Does each chunking of a batch goes through the same process of Queued, Processing and Completed states?

As per documentation : The maximum number of asynchronous Apex method executions (batch Apex, future methods, Queueable Apex, and scheduled Apex) per a 24-hour period For Batch Apex, method ...
user avatar
0 votes
1 answer
22 views

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

I am facing the following issue. I wrote this query for the start method of my batch class. global Date startDate; global Date endDate; global Date currentDate; global Database.QueryLocator start(...
user avatar
  • 35
3 votes
1 answer
62 views

How do I get SerialBatchApexRangeChunkHandler errors to display?

I made a program using batch, when i tried to update the value, status in batch is succesfully, but i got error message in SerialBatchApexRangeChunkHandler, like this: I tried to using this query to ...
user avatar
0 votes
1 answer
71 views

How to deploy a batch class through change sets without a test coverage for that class?

I want to deploy only one class (batch) from sandbox to production and that class have only 10% test coverage but overall code has 80% test coverage. Would it be possible to deploy that class by ...
user avatar
0 votes
1 answer
20 views

i want to use the function in different class for single record id the function is currently used for bulk records, the function execute!

global class iCRM_PopulateDeliveryDateOnOutletBatch implements Database.Batchable<SObject>, Database.Stateful, PSR_TerritoryManagementBatchJob{ ...
user avatar
1 vote
1 answer
129 views

Getting the last record processed in batch apex class

What is the best way to grab the last record processed in one batch? The last record needs to be marked so a new record-triggered flow can begin when the last record in one transaction ends. Thanks.
user avatar
  • 35
-4 votes
1 answer
63 views

Process records in batch with one record parent at time

I have a requirement to process all records of the same parent field in a row. Have you an idea how to do this? Exple : need to get all contacts, I want to do some modification and give a rank to ...
user avatar
  • 3
0 votes
0 answers
74 views

Batch Job to delete specific live agent's chat transcript after 100 days

There are 4 live agent chats enabled in our org. I have to create batch job, that deletes only our division's live chat transcript once it pasts 100 days. what would be the condition or criteria I can ...
user avatar
  • 13
0 votes
0 answers
122 views

Batch class finish method not executing on REQUEST_RUNNING_TOO_LONG error

I intended to send an email to the users when the batch class fails due to any reason. I had placed my logic in the finish method. However, my batch class is failing for the reason : [...
user avatar
-3 votes
2 answers
137 views

How to avoid hitting the limit of batch apex from trigger?

If multiple users trigger the same behavior then there can be more batch processes, that can hit the governor limit. Asynchronous process is needed because there are large number of child records to ...
user avatar
1 vote
0 answers
42 views

Create Batch Apex to update data with no duplicate phone and account

Iam still new at salesforce, I am creating a batch for the requirement in which if contact has duplicates based on account and mobile phone than field named Eksternal ID should not set the value. but ...
user avatar
0 votes
1 answer
38 views

How do I use batch apex if my method is creating over 40000 records

It's just a simple question I'm having(It might sound silly but I've no idea how do I insert 40000 records). I'm first creating 200 Accounts and also creating 200 child Opportunities for each Account. ...
user avatar
0 votes
0 answers
59 views

Time Limit Error on After Save Flow that sends out emails

I need to create a flow that sends out a specific email alert when the Email_to_Send field changes. Email_to_Send is a picklist that has 10 different values. Each value has an email alert associated ...
user avatar
11 votes
2 answers
254 views

Poll for long-running API responses - Solution patterns

Many REST APIs that people want to use from within Salesforce have asynchronous, long-running operation. For example An endpoint POST /api/resource to create a resource returning a handle Id to check ...
user avatar
2 votes
1 answer
140 views

How to know when the last batch job in parallel execution finishes?

I have an apex class that is executed in parallel by calling Database.executeBatch() in a loop, where each instance processes a chunk of a dataset. After all the jobs that were executed finish I need ...
user avatar
  • 2,586
0 votes
1 answer
32 views

executeBatchMethod() runs but fails to trigger start(...) method

I'm debugging a batch class which auto creates a transaction record (a custom SObject). The following is my executeBatchMethod() , @InvocableMethod(label='desc.' description='desc.') public static ...
user avatar
0 votes
1 answer
139 views

Batch class finish method email exceeded

I am trying to send the email with csv file attachment but it returns email limit is exceeded error, so I tried to send email using trigger there it work properly than why it is not working with batch ...
user avatar

1
2 3 4 5
38