ServiceNow - Implementing a Custom Ticket Action in Employee Center

Employee Center in ServiceNow offers a plenty of Functionality for standard ticket types. Sometimes, if you implement an additional type of request, it is also necessary to add specific quick actions, which are available for the end user. For Instance, it makes sense to let user cancel own requests:

To achieve this, we can develop a Widget, analog to "Incident Standard Ticket Actions". The best way is to clone standard widget in Widget Editor.

In Body HTML template we can remove or add Dropdown Options, according to our needs. For instance, if only Cancellation should be available, leave one <li>*-Tag with following markup:

        <a href="javascript:void(0)" ng-if="" ng-click="c.cancelCase()">
            ${Cancel request}


In this Snippet "c" - is a current scope, "" - intern data, which is passed to/from Server Controller, "showCancel" - our variable, which defines, whether the Action is available. "cancelCase" is a Function, which should be implemented as follows in Client Controller:

c.cancelCase = function() {
    $ = "cancel_request";


In Server Controller we should handle the posted Action. To do this, add following code to Server Controller:

    if(input.action == 'cancel_request')
function cancelRequest(caseGr){
    caseGr.state = 7; // closed
    data.confirmation = gs.getMessage('Request cancelled.');
    data.showCancel = false;


Now  the simple Action is ready, let's imagine we additionally want to prompt User for cancellation reasons. To do so, add the following Dialog definition to HTML Template:

    <div class="modal" id="rejectModal" role="dialog">
        <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button aria-label="${Close}" type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title" tabindex="0" style="color:#717171;">${Enter a reason for this rejection}</h4>
                <div class="modal-body">
                    <label for="rejectReason"><span class="field-decorations ng-binding" style="color:#717171;"><span class="fa fa-asterisk mandatory" title="Required" style="padding-right: .25em" aria-label="Required "></span>${Reason}</span></label>
                    <textarea rows="3"
                              style="resize: vertical"
                              placeholder="${Enter reason}">
                <div class="modal-footer">
                    <button class="btn btn-default" data-dismiss="modal">${Cancel}</button>
                    <button class="btn btn-primary" ng-disabled="!" ng-click="c.onReject()">${Reject}</button>


To activate this Dialog, Action button must be defined as follows:

<a href="javascript:void(0)" data-toggle="modal" data-target="#rejectModal" type="button" ng-if="">


After opening the Dialog and entering the reason, which is saved in "" - Variable , submit must be handled in Client Controller:

c.onReject = function() {
    $("#rejectModal").modal('hide'); = "cancel_request";


and Server Controller:

function cancelRequest(caseGr){
    caseGr.state = 7;
    caseGr.comments = rejectReason;
    data.confirmation = gs.getMessage('Request cancelled.');
    data.showCancel = false;


That's it, now this newly cloned and updated Widget must be registered within of Standard Ticket Configuration. To do this, create a new ticket configuration for your custom table, go to "Action Region" and specify your Widget in Action Widget - Field. Mission is accomplished!

Bild von Uladzimir Astapchyk
Uladzimir Astapchyk Uladzimir Astapchyk ist seit 2016 bei HanseVision und seit 2000 als Softwareentwickler tätig und dabei zuständig für die Entwicklung von individuellen Lösungen und Integrationsprojekte in Microsoft-Umfeld. In diesem Bereich analysiert er Anforderungen, implementiert Komponenten zusammen mit seinen Kolleg:innen und den Kund:innen. Alle Artikel des Autors

Ähnliche Blog-Artikel

Mit unserem HanseVision Update sind Sie immer gut informiert über alle Themen rund um moderne Zusammenarbeit, kluge Köpfe, Lösungen und Tools, Referenzen und Aktionen.

Jetzt zum Newsletter anmelden
Updates & Aktionen
Versand alle 4-6 Wochen
Trends & aktuelle Entwicklungen