Reset button to Draft State

frappe.ui.form.on(‘Monthly Schemes’, {
refresh: function (frm) {
if (frm.doc.workflow_state === “Done”)
frm.add_custom_button(“Reset”, function () {
frm.set_value({“workflow_state”: “Draft”});
cur_frm.save();
})
}

});

The above is my code for Reset Button when click the workflow state returns to Draft.

But when I clicked Reset Button is Changed like Not Saved like this image I attached.

Please let me know what’s the Solution for this Porblem.

When it turns to Draft it is be editable when it is done its not editable.

Is their any solution for this?

Is their any solution for this @peterg

I don’t see any difference between this and your other post here:

The answer is the same: you can’t change a document that has docstatus==1. Doc Status 1 means submitted, and submitted documents cannot be changed or unsubmitted.
https://frappeframework.com/docs/v13/user/en/basics/doctypes/docstatus

when i click reset button state has been in “Not Saved”
but when I click reset button I want to revert back to draft state and the fields but be editable.
May I know its is possible? and How it can be done in my .js
so far I done like:
frappe.ui.form.on(‘Monthly Schemes’, {
refresh: function (frm) {
if (frm.doc.workflow_state === “Done”)
frm.add_custom_button(“Reset”, function () {
cur_frm.set_value({“workflow_state”: “Draft”});
// cur_frm.save();

		})
}

});

No, it is not possible. You cannot convert a submitted document back to a draft. This is what we have been trying to tell you.