Hello to all user! Please help me with question.
I have workflow with states like draft, created, approved and rejected. But for a specific user(based on login) and email in the field(sent_by in the doctype) has same login email example123@gmail.com then on clicking save button for new request will bypass the all states and the request will be saved approved state. Because on approve state the whatsapp message will be sent. Can we achieve this functionality?
Hi, yes
This is doable.
Add on more Draft state transition with above condition and next state Approved.
In First Draft state put condition not equal to mentioned user and next state Created.
Thanks,
Divyesh Mangroliya
Thank you for your reply can you please tell me step by step. As i don’t want to save request in Draft state it should directly save in Approved state.
//py file
//hooks.py
doc_events = {
“Volunteer Request”: {
“after_insert”: “app_name.module_name.doctype.volunteer_request.volunteer_request.after_insert_handler”
}
}
Hi,
In ERPNext only three document statuses are available. 0 for Draft, 1 for submitted and 2 for cancelled.
You may create as many as workflow status you want, but doc status you can use out of three only.
Thanks,
Divyesh Mangroliya