How to show warning message before submit sales invoice


I need to create a frappe warning message is appear to the user after clicking submit, but the submitting process depends on what is selected, if (Yes) the complete process if (No) stop the submitting process.

I searched for before_workflow_action but as I searched it used doctype that uses Workflow doctype and I didn’t use workflow in my sales invoice

Has anyone had this case before?

@NCP can you help me in this case

Any help ?

Please check before_submit controller hook. More information [here].(Controllers)

Yes, am already use the below code

			'Are you sure to complete this process?',
				// continue with submit process
				// reject submit process

but is not working as I want

any help ?

Thank you man

    before_submit: async (frm) => {
        let prompt = new Promise((resolve, reject) => {
                'Are you sure?',
                () => resolve(),
                () => reject()
        await prompt.then(
            () => frappe.show_alert("Submitted", 3), 
            () => {
                frappe.validated = false;
                frappe.show_alert("Not submitted", 3)