How to change workflow state of a doctype using python

Dear ERPNext Team,
We want to change workflow state using back-end python programming. Is there any workflow api to be used for this?

Hello, if there is a custom workflow you could change it with

doc.workflow_state = 'YourState'

Thanks for reply, I tried this before but It has some gray areas like:

  • It is not changing the document status parameter respectively.
  • It is not checking that, can we jump to mentioned state from the current state or not. (This we have to check with our own programming)
  • It is not checking that jumping to mentioned state is allowed by current user role or not. (This we have to check with our own programming)

If workflow API not providing this then unfortunately workflows are only good from front end.
If any body else have any information about this please let me know.
If there is no other solution then, me myself is willing to be a volunteer for this workflow API to be dedicated for ERPNext, as i love ERPNext :slight_smile: I can help in making this API.

1 Like

Hello. Did you end up building this API? I also think this will help and happy to contribute

1 Like

Did you able to manage it using python code?