frappe.ui.form.on('Sales Order', {
refresh(frm) {
frm.selected_workflow_action.forEach(action => {
// Assuming action is an object representing each selected workflow action
// Example confirmation message, you can customize it according to your needs
frappe.confirm(
"<b>Are all of the below fields entered correctly?</b><ul><li>Field 1: " + action.field1 + "</li><li>Field 2: " + action.field2 + "</li></ul>",
() => {
// Yes, user confirmed
resolve();
},
() => {
// No, user rejected
reject();
}
);
});
}
});
frappe.ui.form.on('Sales Order', {
refresh(frm) {
if (frm.selected_workflow_action && frm.selected_workflow_action.length > 0) {
frm.selected_workflow_action.forEach(action => {
// Assuming action is an object representing each selected workflow action
// Example confirmation message, you can customize it according to your needs
frappe.confirm(
"<b>Are all of the below fields entered correctly?</b><ul><li>Field 1: " + action.field1 + "</li><li>Field 2: " + action.field2 + "</li></ul>",
() => {
// Yes, user confirmed
resolve();
},
() => {
// No, user rejected
reject();
}
);
});
}
}
});
frappe.ui.form.on('Sales Order', {
before_workflow_action: async (frm) => {
let promise = new Promise((resolve, reject) => {
frappe.dom.unfreeze()
frappe.confirm(
"<b>Are all of the below fields entered correctly?</b><ul>",
() => resolve(), // User confirms
() => reject() // User rejects
);
});
await promise.catch(() => frappe.throw()); // If the promise is rejected, throw an error
},
});