Add_fetch function is not working for child document


What is wrong with this following code? I want to fetch data from a link filed “existing_task”, link option is a “Custom DocType” :

    copy_task: function(frm, cdt, cdn) {
        copyTaskDet(frm, cdt, cdn) ;

function copyTaskDet(frm, cdt, cdn) 
    var task = locals[cdt][cdn];
    if (task.copy_task == '1' && task.existing_task)
        frm.add_fetch('existing_task',  'task_type',     task.task_type);
        frm.add_fetch('existing_task',  'task_subject',  task.task_subject);
        frm.add_fetch('existing_task',  'task_detail',   task.task_detail);
    frappe.model.set_value(cdt, cdn, 'task_type',    task.task_type);
    frappe.model.set_value(cdt, cdn, 'task_subject', task.task_subject);
    frappe.model.set_value(cdt, cdn, 'task_detail',  task.task_detail);