Workflow state via code

hi all,
can anybody already execute workflow via custom buttion in script report (js)


What is your use case? you can set workflow state if you on the same form via code

e.g. cur_frm.set_value("workflow_state", "value to set")

Also, you can set it from python side,

frappe.db.set_value(doctype, docname, "workflow_state", "value_to_set")

But it only set your workflow_state field. Not update doc status and events

@Sangram I created a script report and added button for approval state what i want to do is let the user approve from report.

Any help guys

Write on buttons click which calls the python method.
In a python, method update the workflow_state

frappe.db.set_value(doctype, docname, "workflow_state", "value_to_set")