Hi team,
I am trying to add events on top of a workflow in frappe. When user tries to execute a workflow action, then I should be able to capture a value in the field. I am not able to do that.
Explanation:
Frappe provides a support to write an event function “before_workflow_action” before the workflow is executed. I used this trigger and returned a promise. Now if I try to modify any value inside before_workflow_action using
frm.doc.field1 = “new_value”
my field1 is not changed. I think it is because the frm was already read before it enters this before_workflow_action. So I tried to use
frappe.client.set_value to change the value of field1 to ‘new_value’
But if I do this after I resolve the promise in the before_workflow_action, the next workflow is not getting executed and it failing saying that the document has been modified after you opened it. Try after refreshing the page.
Just FYI:
- I am using frappe.ui.Dialog to capture the value of the field.
- And also in order to make the frappe.ui.Dialog work, I unfreezed the frappe dom.