UI action

Community Alums
Not applicable

Hi All,

I have created escalate ui action on click of action a dialog box. Dialog box is appearing but submit and cancel buttons are not working. Can someone please guide me on this.

 

 
Script Include:
var IncidentTaskHelper = Class.create();
IncidentTaskHelper.prototype = {
    initialize: function() {},

    createIncidentTask: function() {
        var sysId = this.getParameter('sysparm_sys_id');
        var reason = this.getParameter('sysparm_reason');
        var comments = this.getParameter('sysparm_comments');

        if (!sysId || !reason || !comments) {
            return 'Invalid input. Please provide all required fields.';
        }

        var taskGR = new GlideRecord(incident_task);
        taskGR.initialize();
        taskGR.parent = sysId;
        taskGR.short_description = "ITSM Escalation";
        taskGR.insert();
        return 'success';

    },

    type: 'IncidentTaskHelper'
};
 
UI Action:
 
function openEscalateDialog() {

    var dialog = new GlideDialogWindow('escalate_task_dialog');
    dialog.setTitle('Escalate Incident');
    dialog.setPreference('sysparm_sys_id', g_form.getUniqueValue());
    dialog.setSize(500,300);
    dialog.render();
   
}
1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

your script include is not client callable

You can do this without script include like this

HTML:

<?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:ui_form>
		<g:evaluate var="jvar_sysid" expression="RP.getWindowProperties().sysparm_sys_id"/> 

<html>
    <body>
        <div>
        <h2>Escalate Incident</h2>
        <label for = "escalation_reason">Escalation Reason</label>
        <select id = "escalation_reason">
            <option value ="tickets_onhold">Tickets on Hold for more than 24hours</option>
            <option value ="tickets_escalated">Tickets Escalated because end user is chasing for update or would like to expedite the resolution/fulfilment or issue become Urgent</option>
            <option value ="tickets_no_update_24hours">Tickets no update for more than 24hrs</option>
            <option value ="tickets_unassigned">Tickets Unassigned</option>
            <option value ="tickets_noupdate">Tickets No Update</option>
        </select>
        <br/><br/>
        <label for ="escalation_comments">Escalation Comments</label>
        <textarea id="task_comments"></textarea>
        <br/><br/>
        <g:dialog_buttons_ok_cancel cancel="return onCancel();" ok="return onSubmit();"/>
		<input type="hidden" id="task_sys_id" name="task_sys_id" value="${jvar_sysid}"/>
    </div>
</body>
</html>
</g:ui_form>
</j:jelly>

Client Script:

function onCancel() {
    GlideDialogWindow.get().destroy();
    return false;
}

function onSubmit() {
    var taskSysId = gel('task_sys_id').value;
    var app = new GlideRecord("incident_task");
    app.initialize();
    app.parent = taskSysId;
    app.short_description = "ITSM Escalation";
    app.update();
    window.open('/incident.do?sys_id=' + taskSysId);
}

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