Supplier Invoice Date in Payment Entry Reference Table

Greetings everyone!
In the payment entry reference, I included the invoice date custom date field.
I built a custom script to link it to the invoice date of the supplier, but it doesn’t work.
That script is referenced below.
Thank you for your assistance. Thanks.

frappe.ui.form.on(‘Payment Entry Reference’, {
invoice_date(frm) {
cur_frm.add_fetch(“purchase_invoice”, “supplier_invoice_date”, “invoice_date”);
}
});

Hi Bilal,
try placing add_fetch() outside the event like this:

cur_frm.add_fetch(“purchase_invoice”, “supplier_invoice_date”, “invoice_date”);
frappe.ui.form.on(‘Payment Entry Reference’, {
  invoice_date(frm) {
    // add_fetch() shouldn't be placed here.
  }
});

Sir Thanks for your response, I tried this code but its not work.

Hello Bilal,
here is some sample code from my project, hope it helps:

cur_frm.add_fetch('sales_order',  'delivery_start_date',  'from_date_commissioning');
frappe.ui.form.on("ProjectEmployee",{ ... }

Used fields:
sales_order : a field defined in my doctype “ProjectEmployee”, has to be a link to doctype “Sales Order”


delivery_start_date : a field in doctype “Sales Order” whose value I want to fetch
from_date_commissioning : a field in my doctype “ProjectEmployee” that will receive the fetched value.

Please compare this setup with yours.
Also check the javascript-concole (press F12 in Firefox or Edge) for errors.

Hello Bilal,

I am trying to do the same thing.
Have you figured it out?