Need to show popup on incident pages

admin110
Kilo Contributor

Hi Team

I'm currently working on a project and encountering some difficulties. I need to implement a feature where a button is displayed on incident pages, and upon clicking it, a popup should appear.

Please help and suggest how can achieve it.

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

There are several thread which can help you create a UI page to display the pop-up. You can use the solution based on your requirements.

https://www.servicenow.com/community/developer-articles/custom-ui-page-in-a-popup/ta-p/2319550

 

https://www.servicenow.com/community/now-platform-forum/how-to-create-a-popup-dialog-box-on-a-ui-act...

https://www.servicenow.com/community/itsm-forum/i-want-to-cancel-confirm-window-after-clicking-cance...

 


Please mark this response as correct or helpful if it assisted you with your question.

Sumanth16
Kilo Patron

Hi @admin110 ,

 

Please modify below according to your requirement:

function resolveIncidents() {
    var answer = confirm("Please ensure workaround field has been updated before resolving related incidents.");
    if (answer == true) {
        gsftSubmit(null, g_form.getFormElement(), 'resolveincidents');
} else {
    return false;
}
}

if (typeof window == 'undefined')
    resolveIncidentFunction();

function resolveIncidentFunction() {

    var incident = new GlideRecord("incident");
    incident.addQuery("problem_id", "=", current.sys_id);
    incident.addQuery("incident_state", "=", IncidentState.AWAITING_PROBLEM);
    if ((typeof IncidentReason) !== "undefined")
        incident.addQuery("hold_reason", "=", IncidentReason.AWAITING_PROBLEM);
    incident.query();
    while (incident.next()) {
        incident.incident_state.setValue(IncidentState.RESOLVED);
        incident.close_notes = 'This incident is resolved based on workaround provided in related problem investigation number ' + current.number + '.' + ' The Workaround is ' + '(' + current.work_around + ')';
        incident.close_code = 'solved_workaround';
        incident.update();
        gs.addInfoMessage(gs.getMessage('Related Incidents Resolved'));
        action.setRedirectURL(current);
    }
}

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda