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.

313 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
42 views

Unit Testing Class

I'm having this method which I can't test in my test class. It's my call on my ReplayFuture.cls, wich is called from my oppbatch class. if(replayRecord.MethodName__c == ReplayConstants....
1
vote
0answers
82 views

Report on the top 20% of Customers Only

I need to report only on Contacts who are contributing to the top 20% of revenue. Payment is stored on Customer which is a Master-Detail to Contact, one Contact can be a Customer multiple times. In ...
1
vote
1answer
249 views

Batch job sporadically does not get rescheduled

I have a batch process that I've got scheduled to run after hour (want to increase it to every 15 minutes) and it is currently working 90% of the time just fine, but about once a week is does not get ...
1
vote
1answer
159 views

Efficient way to get the first data in batch process iteration

This problem is quite related to my first question in this link Get Data from batch iterable I have created a functionality that will upload data to salesforce object using csv. My problem at the ...
1
vote
0answers
536 views

Stop batch process and jump to finish()

I have created a batch process and inside the execute function, there is a condition. If a condition is meet, I want to stop the batch process and then call another batch process. What I am currently ...
1
vote
0answers
367 views

How to find duplicate leads for given set of leads?

Here is my requirement and I am confused on how to solve this. So please help me. Requirement: We have set of leads, the count could be any where from 50 to 1000 leads. Client wants to know for each ...
1
vote
0answers
19 views

Unable to Commit Batch Uploads (No Error Script)

Has anyone else had any issues with committing batch uploads into records? There is no error message and the status remains in "processing for upwards of 24hrs". The records I am trying to process ...
1
vote
0answers
258 views

Apex Scheduled Jobs Error

I am trying to scheduled a job but I get the following error: You have exceeded the maximum number (100) of Apex scheduled jobs. However when I checked my current scheduled jobs, I see only 2 jobs ...
1
vote
0answers
100 views

how to Read and write salesforce data from Heroku for app

We are planning to create app, which will read data from salesforce, do processing and then write result back into salesforce. This operation will happen in 2 modes 1. Real time when user takes any ...
1
vote
0answers
74 views

Large data processing in salesforce

I was trying to find out some other ways of processing data other than batch apex. But most of information getting only about using batch apex. Is there any other way to process large data synchronous/...
1
vote
0answers
2k views

Apex code to Export Csv file to ftp server

I have to write an apex batch scheduler to send user information csv to some ftp server. I am able to generate the csv file with user records but I don't know how to send this csv file to ftp server ...
1
vote
0answers
73 views

Flexible API Limits—Question

Please can someone confirm the following about Flexible API limits: Provides the ability for me to queue up more than (5) batch jobs for processing. Only (5) jobs are executing at any one time and ...
1
vote
0answers
350 views

Batch Iterable (Apex CPU time limit exceeded) List<Map<>>

I'm not sure what I'm doing wrong with my Batch Iterable class. I'm trying to create a List of Maps. I'm passing in an entire Map (accountToNewAndOld) which gets broken up into and added into a List ...
1
vote
0answers
1k views

How to get the value from a batch apex class to a normal apex class

So I've created a batch class, did a query, and stored the results into a map. Now I know that you can pass values from one batch to another with cascading batch calls and database.stateful, but is ...
1
vote
0answers
506 views

How to populate a map using Batch

So I have to create a map using an object implementing the batch interface. I have used the Database.stateful interface to make sure all instances of the batch are inserting into the same table. The ...
1
vote
0answers
1k views

Add/Remove Campaign Members Based on Contact List using Apex

I'm having a hard time figuring out the logic for this in Apex. In C# I would just use linq. I have an existing campaign that I want to add/remove members based on new lists of contacts. Basically, ...
1
vote
0answers
241 views

Making apex callout after sendEmail() in Batch apex

This is related to question, Processing callouts from Batch, but is specific to Emails operations. We are sending contents of email in apex callouts. The content contain merge fields, which is not ...
1
vote
0answers
2k views

I am executing a Batch Apex class to delete the records from Recycle Bin but the records are not getting delete?

This is my code: global class EmptyRecycleBin implements Database.Batchable<sObject>{ global Database.querylocator start(Database.BatchableContext BC){ string query ; return Database....
1
vote
0answers
910 views

Creating attachment(document record) through batch apex when size greater than 5MB

I wrote batch class which creates a excel file in documents folder. But my problem here is when the size of excel reaches 5MB then the heap size error is shown and batch fails after certain records(...
1
vote
0answers
827 views

Scheduled Batch Apex class

I need to write a Scheduled Batch Apex Class on two Objects Case and Ticket__c. Note: Ticket__c Has a look up to the Case. So, a case can have multiple tickets but a ticket can only be associated to ...
1
vote
0answers
839 views

Automatically add Account Team Members to Sales Team on Opportunity using an Apex Batch

We have a requirement to copy Account team members to Sales team of related Opportunity. This should happen on a daily basis.. I am new to salesforce please help me in code to develop this.Any help ...
1
vote
2answers
85 views

EDIT: Apex Batchable job not “starting”

We are trying to create an Apex batch job, but the start() method never seems to be called. The class we are using for the job has the following code: global class BatchableScorer implements Database....
0
votes
1answer
21 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 ...
0
votes
0answers
31 views

Bulk Insert on Child Records

I am trying to implement one scenario for my educational purpose. I have 10 Account records and it has a field Country__c and I want to create 60K child Contact records for each Account Record. It is ...
0
votes
1answer
11 views

Batch Data Entry no longer supported for Gift Entries in NPSP

I am trying to insert the gift entries to salesforce in NPSP but recently salesforce had blocked the use of Batch Data Entry and it showing the page as follows. Now sure how I am supposed to do the ...
0
votes
0answers
19 views

Apex batch not committing records in production but executing without errors. Also working fine in sandbox

I have an apex batch which i tested in sandbox and it is working as expected but in production it is executing without error but not committing the records. I executed the same batch code in anonymous ...
0
votes
0answers
20 views

Batch Apex : Query data from one object and update data in another object based on data in 1st object

I've an object with a date field, if the date passes by a year from today(today - 365)... then i will have to fetch records from another object with name in: 1st object.name and update those records ...
0
votes
1answer
21 views

Task Trigger fired for one record after email send

I just learned in a very painful way that when sending SingleMessage emails tagged to be saved as activity the task trigger is called for each single message at once not in bulk. I'm sending from ...
0
votes
0answers
9 views

How to add conditions in a Batch class when there are n no of clauses

I want to add a clause in the query locator for billingCountry. The commented code runs fine but is there a way to do the same using the NOT IN clause ? I commented line 14,15 and trying to use line ...
0
votes
0answers
12 views

Calling a managed class (in vlocity) in a batch class APEX

Is it possible to make a batch class then call a managed class from the vlocity? I'm trying to do this but I don't have an idea how to start it since I couldn't see the parameters needed for that ...
0
votes
1answer
35 views

Test Class Coverage for Scheduled and Batch Classes

I am attempting to test a scheduled class that calls a batch class to update records. The following test class does not seem to find the Opportunity being created in the test class to pass that list ...
0
votes
0answers
16 views

my batch brings records and identifies if they're acc or cont for a particular field. How do I test it?

@isTest public class ALN_Integration_BatchTest { public static testMethod void metodoTest(){ ALN_Integration__c rec = new ALN_Integration__c(); rec.First_Name__c = '...
0
votes
0answers
18 views

Internal Server Error on Old Sandbox Records - Best Approach

We have a sandbox that is partial. It would appear that the refresh did not bring down everything it was supposed to in order for the instance to work properly. I'm currently working on a batchClass ...
0
votes
0answers
28 views

how to create a related list of object in test class

I have created a test class. Related list part is not covering. On product object UP Relationship is a related list. I have craeted a product and created UP Relationship nd inserted. how to cover if ...
0
votes
1answer
31 views

Issue accessing Custom Setting when instantiating Batch Class

I'm having issues returning values in a Custom setting (Type = List) when I'm instantiating a batch class, and I'm not sure why. I'm doing an upsert in my test class and confirming via system debug ...
0
votes
0answers
42 views

Batch Apex - SOAP Callout Issue

We have implemented a batch Apex solution for mass update records. More specifically, we upload a CSV file (more or less 2500 records) in a custom object and we "read" this CSV to create ...
0
votes
1answer
23 views

Batch job that sends notification to a Contact to complete a work order which was created a week ago

I am trying to create a batch job that sends a notification to a Contact to complete a work order which was due a week ago and if the custom field Resolution__c is empty. I've written the below code ...
0
votes
0answers
19 views

Contact Duplicate error not fired while upserting duplicate Contacts in bulk in apex

We have a Duplicate Rule defined on Contact Object. The requirement is to insert or update Contact records in Batch apex. Ideally, if any duplicate is found I should get Duplicate Error in apex. While ...
0
votes
1answer
34 views

Httprequest doesn't work in batch although Database.AllowsCallouts implemented

We are planning to start new integration functionality to a new system in our landscape (Workday). To do this we created integrations in apex with httpcallouts. We are planning to start the initial ...
0
votes
0answers
44 views

Batch Apex Too many SOQL Queries: 201 on a relationship query

REQUIREMENT Create a batch apex class that needs to update all of the accounts based on the number of contracts and opportunities for that certain account. Here is what I have so far. However, I am ...
0
votes
2answers
67 views

Email Limit Exceeded on Batch Apex

I have a batch job which sends email notification in bulk using Messaging.sendEmail() and its using setTargetObjectId to set the reciepient. It sends out thousands of emails but one day I got case ...
0
votes
0answers
32 views

Fetch Linked Contact details of Account

I am writing a batch, which essentially iterates over account records. following steps. iterate over account based on specific conditions if the account has a linked account to it(lookup to account), ...
0
votes
0answers
31 views

How to display continuation of task records sent from SingleEmailMessage using apex html

How to display continuation of task records sent from SingleemailMessage using apex html. I have sent email with task records using batch in html table, need to send 50 tas records per email but need ...
0
votes
1answer
365 views

How to display Batch Record Process Count on Progress Bar Indicator in LWC?

I am currently working on functionality where I am assigning Bulk Records Ownership to new user. For this, I have designed LWC and which calls helper class. and the helper class call a batch class to ...
0
votes
1answer
15 views

If account has more than 2 contacts then change email in contact field as default email using batch apex

am new of this salesforce here my code is: Thanks: public class Example1 implements database.Batchable<sObject>{ //Map<id,contact>IdContactMapBatch =New Map<id,contact>(); ...
0
votes
0answers
12 views

EmailMessaging wont display the merge fields during the batchprocess

We have created a batchclass to send pending opportunity approval remainder email for the approvers as the flow we are sending email and referred a email template ID in which I have used merge fields ...
0
votes
0answers
26 views

Loop Variable Accessibility Issue

I have a unit test with this context data: List<Contact> testCon = new List<Contact>(); testCon.add(new Contact(AccountId = '0014000000zoemWAAQ', LastName ='Accounts Payable', ...
0
votes
0answers
38 views

Need help getting Batch Apex to work

I am a long time Salesforce admin/developer but I am still getting started with actually writing Apex code so this is probably a simple error on my part. I am trying to use batch apex to call the ...
0
votes
0answers
21 views

Don't know how to execute an Apex Batch in a certain way

ExecuteToolingByOrgsBatch etbob = new ExecuteToolingByOrgsBatch(); etbob.Ids = new List<decimal>{304066}; etbob.code = 'I have code here'; Database.ExecuteBatch(etbob); I have a list of Ids,...
0
votes
0answers
38 views

Dynamic object is not getting inserted

I want to insert dynamic object with dynamic fields and value. I have written below code in execute method and i am getting "Attempt to de-reference a null object" error and not finding where I am ...

1 2
3
4 5
7