resolve incident in SOW

Somnath_snow
Tera Contributor

I have created a button to resolve incident in SOW.  The attached below script is skipping the pop menu and reloading the  the page with the incident resolved. Meaning i am not able click on the OK button in the pop up, before i do it the page reloads. Any solution to this would be helpful.

Somnath_snow_0-1709829024170.png

Here is the code:

function onClick(g_form) {
    g_form.setValue('state', 6);
    g_form.submit();
    g_form.save();

    var rc = g_form.getValue('close_notes');
    var rc1 = g_form.getValue('close_code');

    if (rc != "" && rc1 != "") {
        g_modal.confirm('Are you sure you want to proceed?', function(response) {
                if (response) {
                    g_form.setValue('state', 6);
                    g_form.submit();
                    g_form.save();
                }
                return false;
        });

           
    }
}
3 REPLIES 3

Alok Das
Tera Guru

Hi Somnath,

 

You need to save and submit in the ui page which you are invoking from ui action. The below code is responsible for saving, submitting and reloading of the form.

g_form.submit();
g_form.save();

Kindly mark my answer as Correct and helpful based on the Impact.

Regards,

Alok

Sorry Alok , didn't get you. can you please elaborate.

I can see from your code that you are trying to get some pop up and from pop up you want to decide whether to proceed or cancel the form submission.

However, In your UI action itself you wrote the code to save and submit the form. Due to which the system is not waiting for the confirmation from the dialog box and submitting the form. Form submission causing the page to reload with the latest saved data.