How to fectch data from the link doc

Please do help me.I would grateful.
I have created two doctype(childdoc and parentdoc)

I have link childdoc field docname with parent docname

so that as i choose parentdoc i wanna set firstnam and lastname of parent in child field.I have also attached doc field detail

following are code which i wrote child.js file.Please do correct me if i am doing wrong.Your help will be highly apcreciated

frappe.ui.form.on("child", {
  docname(frm) {
    frappe.msgprint("bwwhutan");
    frappe.call({
      method: "frappe.client.get",
      args: {
        doctype: "parentdoc",
        name: frm.doc.docname,
      },
      callback: (r) => {
        if (r.message) {
          frappe.set_value("fname", r.message.fname);
          frappe.set_value("lname", r.message.lname);
        }
      },
    });
  },
});

Please click on the link use fetch from field in doctype or customie form
Fetch Data from Doctype

Hello,

Please check your trigger name in your script. It should matched with the Name not with the Label set on your DocType fields.

Regards,

Ivan