Osk
1
how can make field (agency_name) mandatory before change next status when choose “Send to agency” action
frappe.ui.form.on('Device Maintenance Card', {
before_workflow_action: (frm) => {
if ((frm.selected_workflow_action === 'Send to agency'))
{
frm.set_value("date_of_receipt_from_agency", frappe.datetime.now_datetime());
frm.refresh();
frm.save();
}
}});
thanks in advance
Osk
3
thank you for the help but i still cant do my idea could you please explain more
Hello @Osk ,
Try will server script.
if doc.workflow_state == "YOUR NEXT WORKFLOW STATE" and not doc.field_name:
frappe.throw("field_name is mandatory")
Example
if doc.workflow_state == "Approved" and not doc.approver:
frappe.throw("approver is mandatory")
1 Like
Osk
5
there is an error in syntax
Hello @Osk ,
write it in server script
Osk
8
i did but unfortunately the field of agency_name was empty but it didn’t prevents me
to fill it there is no validate.
Change DocType Event to Before Save
Osk
10
well done. … thank you for the help