I am working with Workflow from Frappe Framework version-16 without any other apps installed. The Workflow is such a powerful tool but I can’t seem to find a way to easily enable an Action dropdown in the Web Form. I had to add the following “Client script” to simulate what would an action down down would do:
frappe.web_form.after_load = () => {
// At this point, frappe.web_form is guaranteed to be fully initialized
const field = frappe.web_form.get_field('state');
const doc = frappe.web_form.doc;
if (!field || !doc || !doc.state) {
console.log('### a03', doc);
return;
}
frappe.call({
method: "frappe.model.workflow.get_transitions",
args: { doc: doc },
callback: function (r) {
if (r.message && r.message.length > 0) {
// Collect action names (e.g., "Accept", "Reject")
let options = r.message.map(t => t.next_state);
// Keep the current state in the list so the field isn't blank
if (!options.includes(doc.state)) {
options.unshift(doc.state);
}
console.log('### a03', options);
// Update the field options and refresh the UI
field.df.options = options.join('\n');
field.refresh();
}
}
});
};
Is this the only option? Am I missing a config somewhere? Presumably I should be able to easily add an “Actions” drop down to make transition of the workflow state easily?