Child Table Link Field Population

This is the invoices child table

In method it should be g1.g1.plan_management.doctype.participant_funding.participant_funding.servicedefiner

Changed it, still the same :pensive:

You are gain passing self in servicedefiner remove it and then try

Done. Still the same. Here’s the screenshot

Can you share screenshot of error

Um, there’s no error exactly, nothing is showing up in the error log either. It’s just not populating the child table

You haven’t imported frappe

In py file

How do I do that? I just made changes to the default .py file of the doctype

import frappe

Type in participant_funding.py below line 7

Done. Still the same. :pensive:

Sure, ill message you the details

Issue is with path in js frappe.call method

Can’t we skip calling the server method and use an API call instead? Like this code snippet :

frappe.call({
    method:"frappe.client.get_list",
    args:{
        doctype:"Invoice PM",
        filters: [
            ["participant","=", frm.doc.participant]
        ],
        fields: ["parent"],
        parent: "Participant"
    },
    callback: function (response) {
        /* I cant figure out this part */
    }
});

Then you can use

if (response.message) { var row; for (row in response.message){ var childTable = frm.add_child("Child Table Name"); childTable.'DOC-FIELDNAME' =response.message[row]['FieldName']; } frm.refresh_fields("Child Table Name");

This adds nothing to the childtable. Here’s my code:

frappe.call({
        method:"frappe.client.get_list",
        args:{
            doctype:"Invoice PM",
            filters: [
                ["participant","=", frm.doc.participant]
            ],
        fields: ["parent"],
        parent: "Participant"
    },
    callback: function (response) {
        if (response.message) {
            var row;
            for (row in response.message){
                var childTable = frm.add_child("Invoices");
                childTable.invoice =response.message[row]['docname'];
            }
            frm.refresh_fields("Invoices");
        }
    }
});

Here’s the console :

why ‘docname’ it should be field name like participant or total

Okay so docname is a field which contains the document name (which I want to insert into the invoice (link field) of the child table). docname is the document name for Invoice PM Doctype