dialog box in esc

AlekhyaD
Tera Contributor

Hi, 

I have created escalate action under actions of incident and on click of incident a dialog box will appear with two fields escalation reason and escalation comment which was scripted in separate widget and called that escalate widget in client controller of Incident Standard Ticket Actions. submit and cancel buttons are added from spmodal client controller and After filling two fields if user clicks on submit a incident task should be created and escalation comment should be copied to incident task description and escalation reason should be copied to incident task escalation reason field where its not working but setting all other fields is working am not able to retrieve the value from this two fields on widget.

Below are the scripts:

 

Escalation widget:

 

<div class="modal-header">
<h3 class="modal-title">Escalate Incident</h3>
</div>
<div class="modal-body">
<div class ="form-group">
<label for="escalationReason">Escalation Reason<span style="color:red;">* Escalate Reason is Required.</span></label>
<select id= "escalationReason" name = "EReason" class="form-control" ng-model="modalData.escalationReason" required>
<option value = "">---Select a Reason---</option>
<option value ="tickets_on_hold_for_more _than _24hours">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_no_update">Tickets No Update</option>
</select>
</div>
<div class ="form-group">
<label for="escalationComment">Escalation Comment<span style="color:red;">* Escalation Comment is Required.</span></label>
<textarea id="escalationComment" name = "EComment" class="form-control" rows="4" ng-model="modalData.escalationComment" required></textarea>
</div>
</div>

 

incident standard ticket actions :

 

client controller

 

$scope.escalateIncident = function() {
        spModal.open({
            widget: "escalate_dialog_widget",
            size: "md",
            //message: 'What would you like to name it?',
            buttons: [{
                    label: '✘ ${Cancel}',
                    cancel: true
                },
                {
                    label: '✔ ${Submit}'
                }
            ]

        }).then(function(modalData) {
            if (modalData && modalData.escalationReason && modalData.escalationComment) {
                console.log("Escalation Data: ", modalData);
                $scope.data.action = 'escalateIncident';
                $scope.data.escalationReason = modalData.escalationReason;
                $scope.data.escalationComment = modalData.escalationComment;
                console.log('escalationReason', escalationReason);
                console.log('escalationComment', escalationComment);

                $scope.server.update().then(function(response) {
                    console.log("server Response: ", response);
                    if (response.isIncidentEscalated)
                        spAriaUtil.sendLiveMessage(c.escalatedIncidentMsg);
                });
                $scope.$emit('focusOnActions', {
                    "isFocusRequired": true
                });

            }
        });

    };
 
Server script:
 
if (input && input.action == 'escalateIncident' && incidentGr.get(incidentSysId)) {

        var gr = new GlideRecord('incident_task');
        gr.addQuery('incident', incidentSysId);
        gr.addEncodedQuery('short_descriptionSTARTSWITHITSM Escalation');
        gr.query();

        var count = 0;
        while (gr.next()) {
            count++;
        }
        count++;

        var userName = gs.getUserDisplayName();
        var incidentTask = new GlideRecord('incident_task');
        incidentTask.initialize();
        incidentTask.incident = incidentSysId;
        incidentTask.short_description = "ITSM Escalation" + ' ' + count + ':' + ' ' + userName + ' ' + "has requested ITSM assistance";
        if (input.escalationReason) {
            incidentTask.u_escalation_reason = data.escalationReason;
        }
        if (input.escalationComment) {
            incidentTask.description = data.escalationComment;
        }
        incidentTask.description = data.escalationComment;
        incidentTask.u_escalation_reason = data.escalationReason;
        incidentTask.assignment_group = gs.getProperty('IT Operations');
        incidentTask.insert();

    }
 
Am not able to set   incidentTask.description and incidentTask.u_escalation_reason. Can someone please guide me here. Thanks in Advance.

 

 

0 REPLIES 0