here you need to add the trigger i.e. before_workflow_action: async (frm) => { ....

Check out my code above that’s how I used it.
And finally you need to add this line await promise.catch((err) => frappe.throw(err));
If you want to throw some error then add anything in the brackets of reject like reject("You can't Calibrate at this state")
2 Likes