You need to sign in to do that
Don't have an account?
Phuc Nguyen 18
Queueable Class to execute in Batch class
Hello All,
I have a Queueable class that I want to execute in a Batch class but I am not sure how to pass the list of Leases to the Batch and execute.
Any suggestions will be greatly appreciated.
Batch
Cheers,
P
I have a Queueable class that I want to execute in a Batch class but I am not sure how to pass the list of Leases to the Batch and execute.
Any suggestions will be greatly appreciated.
public class UpdateLeaseQueueable implements Queueable { List<Lease__c> updateLeases = new List<Lease__c>(); public UpdateLeaseQueueable( Map<Id, Lease__c> leases) { updateLeases.addAll(leases.Values()); } public void execute(QueueableContext qc) { if (!updateLeases.isEmpty()) { //pass leases to Batch class } } }
Batch
global class UpdateLeaseQueueableBatch implements Database.Batchable <sObject>, Database.Stateful{ global Database.QueryLocator start(Database.BatchableContext bc){ } global void execute(Database.BatchableContext bc, List<> listLease){ } global void finish(Database.BatchableContext bc){ } }
Cheers,
P
Change the batch as like below:
Queuable Class:
https://salesforce.stackexchange.com/questions/306693/pass-insert-list-to-batch-apex-from-trigger
https://salesforce.stackexchange.com/questions/194505/passing-parameter-in-batch-apex-to-another-batch-apex
https://salesforce.stackexchange.com/questions/103223/passing-parameter-to-batch-apex/103224
Thanks,
Maharajan.C
All Answers
Change the batch as like below:
Queuable Class:
https://salesforce.stackexchange.com/questions/306693/pass-insert-list-to-batch-apex-from-trigger
https://salesforce.stackexchange.com/questions/194505/passing-parameter-in-batch-apex-to-another-batch-apex
https://salesforce.stackexchange.com/questions/103223/passing-parameter-to-batch-apex/103224
Thanks,
Maharajan.C
So in the Batch execute do I just do something like this to iterate through the list and perform the update? Thanks again.
P
Getting an error in the Batch class.
Illegal conversion from LIst<Lease__c> to Database.Querylocator
Any thoughts?
Thank you,
P