I have a workflow defined, now when I click on “Approve” I want to give a frappe.confirm dialog box and if the user clicks the “Yes” then the doc should be approved, if “No” is clicked then the workflow state should remain unchanged.
I have tried do in the following way from the client side-
But I couldn’t figure out to stop the change of the workflow, frappe.validated = false doesn’t work
Can someone suggest a way here? Thank You.
I want to add a confirmation dialogue box for my workflow. Please tell me where do I need to add the code? I have added the following custom script for my doctype.
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")
Hello @MSR806 ,
I have very a similar script as you (promise.catch…), everything works perfectly but now after frow call the screen is freezen (all is gray and everything is unclickable). Do you have a same issue, please?
No I haven’t encountered the issue you described. 2 things I’d suggest:
Clear caches (both in bench and in browser)
Try another doctype
It could just be a caching issue in which case, step 1 should solve it. If not, it’ll help to know if it’s peculiar to only some specific doctypes or a general issue
Hello @wale,
thanks for answer and tips.
I have tried both but nothing helps.
Next I have tried setup a new bench on another pc (iMac) with just frappe app (v. v14.34.0 (version-14)).
Setup worklow on “ToDo” dct and client script (above), but the result is still the same unfortunately
I have tried the same client script (on ToDo dct) on site hosted on the frappe.cloud and here the screen is frozen after click “no”.
Hello @Jiri_Sir ,
I have been facing the same issue. It’s basically freezing at the very moment when the dialog is shown.
did you get to solve this issue?
I could figure out the issue. The screen freeze is applied before workflow action and unfreeze after workflow action. So we just need to frappe.dom.unfreeze() before showing dialog and it works.
When working on a KDV Hesaplama (VAT Calculation) tool, you might allow users to change the workflow state—such as switching between calculating VAT included or VAT excluded. To prevent accidental changes, you can add a confirmation dialog box using JavaScript. For example, when a user selects a different calculation mode from a dropdown menu, a confirmation box can appear asking, “Are you sure you want to change the VAT calculation mode?” If the user confirms, the new mode is applied; if not, the selection stays unchanged. This ensures that users don’t accidentally switch modes and end up with incorrect VAT results.