function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yoni LegacyYoni Legacy 

Batch job not updating child records

I hope you can help me again experts.
My question is, can I still update locked records (No edit button after submitting the record) the page is visualforce, I'm not sure if the edit button is just hidden after the status changed to submitted or the record is totally locked.

Here is the code which I created and somehow is not editing the Call date/time of the child records.
global class Eisai_Batch_updateAttendeeCallDate_cls implements Database.batchable<sObject>, Database.Stateful{
Map<Id, Call2_vod__c> Parentid_Map = new Map<Id, Call2_vod__c>();
List<Call2_vod__c> toUpdateChildCalls_List = new List<Call2_vod__c>();
Set<Id> updatedCallsId_Set = new Set<Id>();
Set<Id> failedToUpdateId_Set = new Set<Id>();

global Iterable<sObject> start(Database.BatchableContext info) {
    return Database.getQueryLocator([SELECT Id, Call_Datetime_vod__c FROM Call2_vod__c WHERE Is_Parent_Call_vod__c = 1 AND Status_vod__c = 'Submitted_vod']);
} //end of start part

global void execute(Database.BatchableContext info, List<Call2_vod__c> scope){

    for(Call2_vod__c newC: scope){
        Parentid_Map.put(newC.Id, newC);

    System.debug('<----MAP RECORD COUNT---->' + Parentid_Map.size());

    List<Call2_vod__c> childCalls = [SELECT Id, Call_Datetime_vod__c, Parent_Call_vod__c FROM Call2_vod__c 
                                        WHERE Parent_Call_vod__c IN: Parentid_Map.keySet()];

    for(Call2_vod__c child : childCalls){

        Call2_vod__c pCallRec = Parentid_Map.get(child.Parent_Call_vod__c);

        if(pCallRec != Null && pCallRec.Id == child.Parent_Call_vod__c){
                child.Call_Datetime_vod__c = pCallRec.Call_Datetime_vod__c;

    System.debug('<-----CHILD RECORD TO UPDATE----->: ' +   toUpdateChildCalls_List.size());

    for(Database.SaveResult sr : Database.update(toUpdateChildCalls_List,false)
            updatedCallsId_Set = sr.getId();    
        }else {
            failedToUpdateId_Set = sr.getId();
}//end of execute part

global void finish(Database.BatchableContext info){
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    mail.setSenderDisplayName('Salesforce Support');
    mail.setSubject('Eisai_Batch_updateAttendeeCallDate_cls Batch Job Run Completed');

        'Child calls Call Date/Time field are now aligned with the Call Date/Time field of their Parent Call' + '\n' +
    Messaging.sendEmail(new Messaging.Email[] { mail });
}//end of finish part
}//end of batch

I'm just a self taught trying hard developer and lone developer in the team. So please help. Thanks in advance
Yoni LegacyYoni Legacy