Hello,
I am new in ERPNext and I have a problem with the script below. I am trying to set the custom field as mandatory in client script. The system should check the content of the custom field “problem_code” during before_workflow_action == “Work complete” and if this field is empty then set the field as mandatory and call throw. Unfortunately frm.set_df_property(“problem_code”, “reqd”, 1) or frm.toggle_reqd(“problem_code”,true) not work.
frappe.ui.form.on("Task", {
before_workflow_action: (frm) => {
if ((frm.selected_workflow_action === "Work Complete") && (!frm.doc.problem_code))
{
//frm.set_df_property("problem_code", "reqd", 1);
//frm.toggle_reqd("problem_code",true);
frappe.throw("Please fill all the mandatory field 'Problem code'.");
frappe.validated = false;
}
},
});
Thanks for tips in advance.