Child Table Link Field Population


Okay so it’s pulling in the appropriate documents but its not adding them to the child table

now use docname

I did, same result.
fields:["docname"]

Use this code now

Share your code screenshot of js

frappe.ui.form.on("Participant Funding",{
    verify: function(frm, cdt, cdn){
        frappe.call({
        method:"frappe.client.get_list",
        args:{
            doctype:"Invoice PM",
            filters: [
                ["participant","=", frm.doc.participant]
            ],
        fields:["docname"]
    },
    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");
        }
    }
});

Verify is a button im using

1 Like

Participant funding is your child doctype?

Nope it’s the parent for the child table which is called Invoices

I know. in actual participant funding is child doctype

Yes it’s the target

I am confused. This code is not populating the data

Yeap, it just refreshes the page. It is pulling the data, the issue lies with adding it to the child table

First tell me is Participant FUnding parent doctype or child doctype?

Parent: “Participant Funding”
Child table: “Invoices”

Then why you are using cdt and cdn.

I’ll remove and try

Same result

Not populating

Yeap, its not populating the child table

put refresh fields after childtable.invoice and see what happens also do console.log of ```
response.message[row][‘docname’

And share screenshot