Automatic Workflow State Update

Good day All

I’m trying to trigger an automatic Workflow Action in the Doctype, after the Doctype has been Submitted.
Case Scenario:
Workflow of Employee Advance, after submitting the Doctype, the Workflow State “Approved - Unpaid”. Next, creating the Payment Entry. After that, the Original Doctype Status is turned into “Paid”. However, in the Workflow, the User must click on the Workflow Action to turn it into the next Workflow State “Approved - Paid”,

I tried using the Server Script page to make the automatic trigger, but no luck.
Here’s the code I used:

if doc.status == "Paid":
    doc_ea = frappe.db.set_value('Employee Advance',, 'workflow_state', 'Paid - Expenses Pending')
    doc = doc_ea.reload()

The Script Type is “Doctype Event”, the Reference Document Type is “Employee Advance”, and the DocType Event is “After Submit”.
Note: also in DocType Event = “After Save (Submitted Document)”

Would appreciate some guidance on this matter
Thank you :smiley:

Hi @Mohd_RTC21 ,

were you able to fix the issue?