Hi,
I’m trying to get the print format to change depending on the value in my form. So for example if a field value is equal to ABC, I would like to use the print format called ABC Deisng. But if the value is CBD, then I woul dlike to use another pritn format. Both are on the same doctype, I just need to show different information depending on the type of document thiis is. Here is an example code:
frappe.ui.form.on(‘Production Order’, {
onload: function(frm) {
// Set the default print format when the form is loaded
set_default_print_format(frm);
},
before_print: function(frm) {
// Set the default print format before printing
set_default_print_format(frm);
}
});
function set_default_print_format(frm) {
if (frm.doc.operation === “ABC”) {
frm.meta.default_print_format = ‘ABC Design’;
}
}
This code was recomended by Chat GPT, I wasn’t able to find anything in this forum or documentation for my specific issue. Is there a way I can get what I am requiring? Or not worth wasting my time?
Thanks in advance!