I need to make a button on my “action” doctype which saves the form (i.e. the current doctype) and update the workflow status.
I created the button (called “done”) and I’m able to print message or update fields with it. But I can’t figure out how to save the doctype and update the workflow status. I tried two things but none works:(
Write a server script in the .py file of the “action” doctype and call the method from js
My .py code:
Call the savedocs method which is define in “frappe-bench/apps/frappe/frappe/desk/form/save.py” in my .js script:
cur_frm.cscript.done = function(doc) {
cur_frm.call({
method: “frappe/frappe/desk/form/save.savedocs”,
args: { }
});
}
This option is obviously better if it works.
@rmehta I tried jquery to find the element. I was able to find all menu elements (under menu), but the Actions elements are not accesisble at all with jquery, Any suggestions?
I have tried the following -
//The below code doesnt get the elemenst under Action.
$( “div.btn-group.actions-btn-group.open” ).find(“a.grey-link”).each(function( index ) {
//The below code doesnt get the elemenst under Action.
$( “div.offcanvas-container” ).find(“btn-group-actions-btn-group”).each(function( index ) {
console.log( index + ": " + $( this ).html() ); });