HOW TO: Validation for Custom Workflow

The following code will only allow a user with the authorized user role to modify the document.

frappe.ui.form.on("Doctype", "Trigger", function (frm) {
    if (user_roles.indexOf("Authorized User Role") !== 0 && frm.doc.workflow_state == "Enter desired workflow state") {
        msgprint("Message to be printed");
        frm.disable_save();
    }
});
3 Likes

Thank You Very Much