I want to show a dialog box for confirm after each actiion by workflow

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();
                }
            );
        });
    }
});

Screenshot 2024-04-10 111329

The foreach is not working

can anyone help on this

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();
                    }
                );
            });
        }
    }
});

Hi,


this it the image showing cant select nothing

You can read the rest of the comments from the same reference that I shared.

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
    },
});