Can't access workflow properties

I want to use these methods but I get the following error on JS console (at a Doctype which has an active workflow).

Uncaught TypeError: Cannot read property 'get_default_state' of undefined
    at <anonymous>:1:22
(anonymous) @ VM261:1

Functions like frappe.get_doc work fine though. Where am I going wrong?

I would also like to know how can I access frappe.workflow.get_next_state

What is your use case? What are you trying to achieve?

@Sangram I’m trying to access the workflow properties (like current state, next state) for a given doctype.

you can access it directly - doc.workflow_state

I’m saying I need to access the workflow methods, not doc method.

doc.workflow_state is a variable which stores the current state.

How do I get the next state, aka use frappe.workflow.get_next_state

you can find next_workflow_state on validate event. on every workflow action, the document gets Saved.
So, you can capture Next State on validate.

Check this thread

2 Likes

Thanks for your help, marking this as solution :slight_smile: