You need to sign in to do that
Don't have an account?

After delete batch apex issue ?
Hi Team,
I am calling batch apex using trigger after deleting the record, but Start method returns null.
How to query deleted records in batch apex start method.
Please advise any one how to resolve this issue ?
Is it possible to call the batch apex after deleting the records ?
Thanks,
Lakshmi S
I am calling batch apex using trigger after deleting the record, but Start method returns null.
How to query deleted records in batch apex start method.
Trigger : ---------- if(Trigger.isDelete){ Database.executeBatch(new BatchUpdateAcct(Trigger.OldMap),1); } Batch Class ------------- global class BatchUpdateAcct implements Database.Batchable<sObject> { Map<Id,Object__c> mapRecs = new Map<Id,Object__c>(); global BatchUpdateAcct(Map<Id,Object__c> oldValue){ mapRecs = oldValue; } global Database.QueryLocator start (Database.BatchableContext BC){ System.debug('----Start Method-----'+mapRecs.keySet()); return Database.getQueryLocator([Select id,Name from Object__c where id in :mapRecs.KeySet()]); } global void execute (Database.BatchableContext BC, List<Object__c> objList){ } global void finish(Database.BatchableContext BC){ } }
Please advise any one how to resolve this issue ?
Is it possible to call the batch apex after deleting the records ?
Thanks,
Lakshmi S
Greetings to you!
To get or Query deleted records you need to use ALL ROWS. So your query will be:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
To get or Query deleted records you need to use ALL ROWS. So your query will be:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Thanks for your reply.
I have requirement, can you please advise how can we achieve below requirement .
Objects : Account & CustomObject__c (No Relation ship for these two objects)
In Account we have a Division field (Data like North,South,East,West).
In "CustomObject__c" we have Name & division__c (multipicklist) fields.
Example : Suppose we have 5000 Accounts with North division. If i create a record in "CustomObject__c" with North division, we need to update name from custom object to all 5000 Accounts.
How can we achieve this requirement.
Please advise.
Thanks,
Lakshmi S.