Hi,
does the fetch / custom script cur_frm.add_fetch only work with standard docs and not with custom docs?
I have been trying to fetch data from a new doctype to salaryslip but the data does not get fetched.
code used:
frappe.ui.form.on(‘Salary Slip’, {
refresh(frm) {
cur_frm.add_fetch(‘Doc1’,‘field1’,‘field1’);
cur_frm.add_fetch(‘Doc2’,‘field2’,‘field2’);
}
});
Use this, and modify accordingly
frappe.ui.form.on("Inquiry", {
"refresh": function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frm.add_custom_button(__("Create Sales Order"), function() {
frappe.new_doc('Sales Order', {
"customer": cur_frm.doc.company_name,
"inquiry_no": cur_frm.doc.name
});
});
}
});
thanks but it doesnt work for scenario i mentioned
Is there any link field in your salary slip doctype from your custom doctype?
No link field.
This is the code i tried:
frappe.ui.form.on(“Inquiry”, {
“refresh”: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frm.add_custom_button(__(“Create Salary Slip”), function() {
frappe.new_doc(‘Salary Slip’, {
“choice”: cur_frm.mess.choice,
“cnic”: cur_frm.employee.cnic
});
});
}
});
Instead of Inquiry, use your custom doc name