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
17 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
1answer
80 views

How to use Dynamic soql in Batch Apex? [closed]

global with sharing class InsertOr implements Database.Batchable<sObject> { public InsertOr (Set<Id> ids) { for (AccountContactRelation accountContactRelation : (List<...
-1
votes
1answer
88 views

How to execute batch with Dynamic soql?

i use this query in my batch start method : SELECT Id, AccBill__c, OrderBill__c FROM FAB_Order_Bill_Price__c WHERE AccBill__c IN : CustomMap.keySet()OR OrderBill__c IN : CustomMap.keySet() batch ; ...
0
votes
1answer
536 views

How to call AsyncApexJob in test class from batch class finish method

here code is passed and code code coverage is not coverd, Please help me any one Test class test.startTest(); // UpdateOppToInitialize.UpdateOppToInitialize(); UpdateOppToInitialize obj = new ...
0
votes
1answer
24 views

Fetch Batch Database.SaveResults from LWC

I'm working on a LWC component which will work as a simple snap-in to do basic data uploads for very non technical users. My issue is that I want to get the SaveResults from a batch, and pass it into ...
0
votes
1answer
21 views

unexpected token: BillingState

Im learning more about Batch Apex class and I find it pretty cool and helpful. When I remove the Where BillingSate='TX' everything works as expected. Yet when I use the Where condition I get the ...
0
votes
1answer
26 views

Is it possible to update the same field in same object for multiple updates in the same batch class

Please let me know is it best practice to update the same field with different status for the same object in same batch class global void execute(Database.BatchableContext BC, List<SObject> ...
0
votes
0answers
19 views

How to callout inside finish method of Apex batch? [duplicate]

I need to send some data to API when APEX execute success. When I put a callout method inside the finish method of the batch. There is always error shown: Too many future calls: 1 Example code: global ...
0
votes
0answers
30 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
60 views

Convert Apex method to Batch [closed]

I want to convert this method to Batch Apex public void Visibility() { Map<Id, List<Id>> accountContactRelationIdsMap = new Map<Id, List<Id>>(); for (...
1
vote
1answer
23 views

Working with large data volume

I have a design question and I want an expert opinion from the group. Here is the use case: Whenever there is any update on the Booking record (let's say change the status to "Cancelled"), ...
0
votes
1answer
520 views

Apex Batch Job fails if I create and delete a ContentVersion

I just found a strange Salesforce behavior (maybe, an internal defect). If a code tries to insert a new ContentVersion and then delete it (via ContentDocument) within a single APEX transaction (the ...
1
vote
1answer
2k views

Passing a parameter to batchable class

I have the following batchable class: global class batchableClassName implements Database.Batchable<sObject>, Database.AllowsCallouts { global Database.QueryLocator start(Database....
-1
votes
1answer
17 views

how to cover this catch in my batch?

for (APC_I_c rAPC : scope) { rAPC.Error__c = null; rAPC.Type_of_Error__c = null; rAPC.Status__c = 'Processed'; if(rAPC.APC_ID_Account_RCS__c != null){ ...
0
votes
1answer
626 views

Record is Deleted still it is displaying in Look-up Field?

I am running batch in the background where I am creating Master Accounts based on some criteria, however for testing purpose I deleted all Master Account records which were created from running the ...
4
votes
4answers
7k views

delete records from multiple objects via apex batch class

I have a requirement for a process that would delete qualified records from multiple objects. There are about 5 objects and criteria for deletion is the same for all objects. I want to do all of it in ...
0
votes
1answer
1k views

Executing a batch class based on the class name or id entered in as a string or id

I am creating a page in Salesforce that lists all our batch classes and will allow you to execute each one individually. Basically I am querying every ApexClass, finding the batchable ones, and ...
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
1answer
98 views

Bulk Record Issue : Missing value for required field(s) in batch class

Problem facing : Missing value for required field(s): OrderFields: Debug Log details ordPrd.orderId*******null@@@@@@prdId@@@@@a0c3H000000SOp7QAG ord **********OrderItem:{ExternalId__c=24203223, ...
1
vote
1answer
35 views

Bulk sending CustomNotifications using APEX

I could not find any post relating to this any help will be appreciated. Is there anyway to bulk send custom notifications from apex without using a process builder or API? If I use the following code,...
0
votes
0answers
18 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
2answers
430 views

Sending Email to Opportunity team Members (people present in the list) found on Opportunity

I need help on the above mention subject area. Actually, I am working with a batch. I have a object Contrat__c which is related to an opportunity by a lookup field ...
0
votes
1answer
29 views

Array of List<Contact>?

What syntax is needed to add multiple List of Sobjects to an array? I have this code currently in a batch class: public List<Contact> start(Database.BatchableContext bc) { List<Contact> ...
0
votes
3answers
473 views

Not able to update the WhoId field on Task and Event records

I have a batch process that updates the WhoId field of Task records. When this batch process executes, I am currently getting the following error: Update failed. First exception on row 0 with id ...
0
votes
1answer
27 views

SOQL Lookup != null condition in where clause is Selective or Non Selective?

I have a batch class to process some records Select Field1, Field2 from Object where Lookup_Field__c != null && Date_Field__c in (Date1, Date2) Now the Object that this query is on has more ...
0
votes
1answer
44 views

System.UnexpectedException: Start did not return a valid iterable object

I am trying to write a test method for my batch class so I can deploy it, but I am getting this error. System.UnexpectedException: Start did not return a valid iterable object. The batch class looks ...
0
votes
0answers
17 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 ...
5
votes
1answer
103 views

Custom Notifications not working on BatchApexErrorEvents

When long-running batches fail I want the starting user to be notified in the org using Custom Notifications. Therefore I added the marker-interface Database.RaisesPlatformEvents to the Batch class ...
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
478 views

how to Find out who deleted a record in Salesforce

We have ServiceMax managed package custom object in our org. We have found thousands of records have been deleted and they were available in recycle bin. We are able see user id of deleted records. ...
0
votes
1answer
550 views

SandboxPostCopy interface implementation

I have some problems with the SandboxPostCopy interface test class. My goal is to clean some sensitive data on some Object after a refresh. The class is this: global class CleanSandbox implements ...
1
vote
1answer
1k views

how to remove error INVALID_PARTNER_NETWORK_STATUS?

I am getting an error System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: [] In my apex ...
0
votes
0answers
16 views

can I compare two fields like this in system.assert? I have to test a method that assigns the field Name to External id [duplicate]

@isTest public with sharing class AccountTriggerTest { public static testMethod void metodoTestBeforeInsert() { Account account = new Account(Name = 'account_Test'); insert account; ...
0
votes
1answer
32 views

Map giving same data of object while using loop [closed]

I am using a batch class where data iterated over an object Now i am trying to retrieve some fields iterating over object1 Issue - its giving me common id for provider Base value
0
votes
1answer
33 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 ...
2
votes
1answer
2k views

apex batch to transfer and delete data

I am using a custom free app from app exchange to collect feedbacks from contacts about cases. The answers given by the contact are saved in a custom app object, but since the app has some limitations,...
1
vote
1answer
19 views

Im getting “no viable alternative at character '&quot;'” while executing apex class for batch class

I have Created a Batch and test class for code coverage. However Im getting the following error message while executing the test apex. "no viable alternative at character '"'" Batch ...
0
votes
2answers
37 views

how can i leave a field without value if the condiction is true?

for(Account acc : lstAc){ Account acount = new Account(); if (acc.Property_Managment_Company__c == 'Independent') { acount.ParentId = THIS FIELD SHOULD BE EMPTY. }...
0
votes
1answer
25 views

what is wrong in this batch? [closed]

global class ALN_Integration_Batch implements Database.Batchable<sObject> { for (ALN_Integration__c recAln : lstCon) { AccountContactRelation acr = new ...
1
vote
1answer
43 views

I want to get number of user logged in to salesforce with specific profile

I want to get number of users logged into salesforce in every 30 minutes for specific profile. LoginHistory doesn't provide profilename/Id ,how can I achieve this
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
2answers
53 views

Compare String value between runs in Batch Apex

I have the following block of code in Execute method of my batch apex class. for (String fieldKey : objectSchemaMap.get(scope.get(0).Object_Api_Name__c).getDescribe().fields.getMap().keySet()) { ...
0
votes
1answer
21 views

i'm testing a batch. In the last block i have to verify that the list is not empty and the name equal to 'Kinder'. How can I do that?

@isTest public class QWE_Integration_BatchTest { public static testMethod void metodoTest(){ QWE_Integration__c rec = new QWE_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
21 views

Dynamically Scheduling Apex to Run at Various Points in Time for different set of records [duplicate]

My use case is that our Salesforce org will do callout to external system at different times of the day. All these data are stored in a custom object, which basically stores the external system URL ...
0
votes
1answer
22 views

Flag record that is successful upserted in a Batch execution

Have a Batch class that get values from a custom Object and create or update records in another Object. I'm having problem to mark the record from the first object as completed/processed when the ...
-2
votes
1answer
36 views

Is there any alternate ways to handle string in a better way in the below batch class. I feel it looks ugly? [closed]

global class batchFileUpdate implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database.BatchableContext BC) { string reseller= 'RENEWAL_RESELLER'; ...
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 ...

1
2 3 4 5
33