I have a batch class, in that I'm doing a dynamic relationship query my code is as follows
global class RBS_DeleteScheduleBillRunBatch implements Database.Batchable<sObject>{
global String objInvoice;
global String objCreditMemo;
global String objAssociatedAcc;
global String query;
global String ScheduleBillRun;
global RBS_DeleteScheduleBillRunBatch(String inv, String cm, String assAcc, String ScheduleBillRunId){
objInvoice = inv;
objCreditMemo = cm;
objAssociatedAcc = assAcc;
ScheduleBillRun = ScheduleBillRunId;}
global Database.QueryLocator start(Database.BatchableContext BC){
query = 'SELECT Id ';
if(objInvoice != null){
query += ',(SELECT Id,Name FROM Invoices__r)';
}
if(objCreditMemo != null){
query += ',(SELECT Id,Name FROM CreditMemos__r)';
}
if(objAssociatedAcc != null){
query += ',(SELECT Id,Name FROM Associated_Accounts__r)';
}
query += ' FROM ScheduledBillRun__c WHERE Id =:ScheduleBillRun';
System.debug('query >>'+query);
return Database.getQueryLocator(query); }
global void execute(Database.BatchableContext BC, List<ScheduledBillRun__c> scope){
System.debug('scope>>'+scope);
//delete scope;
}
global void finish(Database.BatchableContext BC){
}
}
In debug I'm getting the Id of the parent record only, child record has more than 50k records, I'm not able to understand the problem, the query is properly built but in debug, records are not shown