Issue with Closing Nested Dialog Overlay on UI Action in VR Remediation Task Table

akash pawar
Tera Contributor

Hello Community,

We are encountering an issue with the UI Action named "Request Exception" on the VR Remediation task table. When the UI Action is triggered, a dialog window appears. Inside this dialog, there is a "Request Approval" button that triggers the Take Question page.

Previously, there was a cross ("X") button in the top-right corner of the dialog window that allowed users to close the dialog without submitting the form. However, we have removed this cross button and now need to close the dialog overlay programmatically after the form is successfully submitted (i.e., after the user clicks "Request Approval").

The challenge is how to close the nested dialog overlay only after the form submission has been completed. Is there a way to do this using a script or another method in ServiceNow?

Any help or insights from the community would be greatly appreciated!

akashpawar_0-1737614239643.pngakashpawar_1-1737614257902.pngakashpawar_2-1737614264594.png

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@akash pawar 

so the current Dialog page should close when Request Approval is clicked?

please share your UI page HTML, Client script code

check this as well

"Simple Modal Confirm" UI Page 

did you try this?

GlideModal.get().destroy(); OR

GlideDialogWindow.get().destroy();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello Ankur,
We have tried both possibilities, As we are using the nested UI Pages On the Request Exception UI Action we are getting the Dialog window there we have Request Approval btn and when we Click on it we redirect it to Take Question Questionarie.
Previously we have the cross icon which closes the overlay, but it was allowing the user without filling the mandatory field.
We have Remove the Icon, Now we are not able to Close that Dialog window.

akashpawar_0-1737629952018.png

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <g:evaluate var="jvar_assessment_type" jelly="true">
        var metricGR = new GlideRecord("asmt_metric_type");
        metricGR.addQuery('sys_id', jelly.sysparm_assessable_type);
        metricGR.query();
        var evaluation_type = gs.getMessage('assessment');
        if (metricGR.next())
            evaluation_type = metricGR.evaluation_method.getChoiceValue().toLowerCase();
        else
            evaluation_type = jelly.sysparm_assessment_type ? jelly.sysparm_assessment_type : evaluation_type;
        gs.addInfoMessage(gs.getMessage('You have completed this {0}', GlideStringUtil.escapeHTML(evaluation_type)));
        evaluation_type;
    </g:evaluate>
    <g:requires name="styles/assessment.css" />
    <div class="end-note" data-form-title="$[gs.getMessage('You have completed this {0}', '${jvar_assessment_type}')]">
        <g2:evaluate var="jvar_item" jelly="true" expression="
            gr = new GlideRecord('asmt_metric_type');
            gr.addQuery('sys_id', jelly.sysparm_assessable_type);
            gr.query();
        " />    
        <j2:if test="$[gr.next()]">
            <!-- end_note may contain HTML formatting -->
            <g2:no_escape>$[NS:gr.end_note]</g2:no_escape>
        </j2:if>
    </div>
        <footer class="modal-footer">              
                <button class="btn-default btn" style="min-width: 5em" onclick="return onCancel();" name="cancel" id="cancel">${gs.getMessage('Close')}</button>
            </footer>
</j:jelly>

function onCancel() {
    // GlideDialogWindow.get().destroy();
    // window.location.reload();
    // action.setReturnURL(current);
    window.parent.close();
    return true;
}