how to add action widget on standard page on service portal please see description
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 09:00 AM - edited 09-21-2023 05:28 AM
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2025 09:38 AM
HI Deepika,
I did the same and still do not find the ' action ' dropdown for either incident or RITM as tried on PDI.
Is there anything like i need to link the my request page with 'incident standard action' widget ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
For Request:
Widget Name: Request Standard Ticket Actions
HTML:
<div>
<div class="dropdown" id="child-case-tabs" ng-if="data.showActions">
<button type="button" id="actions-button" class="btn btn-default dropdown-toggle action-btn" data-toggle="dropdown" style="width : 100%" aria-haspopup="true" ng-init="setFocusOnActionButtons()">
${Actions}
<span class="fa fa-caret-down"></span>
</button>
<ul class="dropdown-menu pull-right" id="actionList">
<li ng-if="data.canCancel">
<a href="javascript:void(0)" ng-click="$event.stopPropagation();cancelRequest()">${Cancel Request}</a>
</li>
</ul>
</div>
</div>Server Script:
(function() {
var requestGr = new GlideRecord('sc_request');
var requestSysId = options.sys_id;
if (!requestSysId && $sp.getParameter('table') == 'sc_request')
requestSysId = $sp.getParameter('sys_id');
if (input && input.action == 'cancelRequest' && requestGr.get(requestSysId) && hasPermissions(requestGr, "write")) {
requestGr.request_state = 'closed_cancelled';
requestGr.stage = 'closed_complete';
requestGr.update();
gs.addInfoMessage(gs.getMessage("Request cancelled."));
}
if (requestGr.get(requestSysId) && hasPermissions(requestGr)) {
data.canCancel = requestGr.request_state == 'requested' || requestGr.request_state == 'in_process';
data.showActions = data.canCancel;
}
function hasPermissions(gr, operation) {
if (operation == "write" && gr.canWrite())
return true;
return (gr.getValue("requested_for") == gs.getUserID()) || (gr.getValue("opened_by") == gs.getUserID());
}
data.i18n = {};
})();Client Script:
function requestTicketActions($scope, $http, spUtil, $timeout, spModal, i18n, $window, $uibModal, spAriaUtil) {
var c = this;
c.doneLoading = false;
c.cancelledRequestMsg = "${Cancelled Request}";
var MOBILE_DEVICE_SCREEN_WIDTH = 767;
$scope.mobileDevice = c.data.isMobile || ($window.innerWidth < MOBILE_DEVICE_SCREEN_WIDTH);
$scope.cancelRequest = function() {
$scope.data.action = 'cancelRequest';
$scope.server.update().then(function(response){
spAriaUtil.sendLiveMessage(c.cancelledRequestMsg);
location.reload();
});
$scope.$emit('focusOnActions', {"isFocusRequired": true});
};
function init() {}
$(document).on('click', 'div.modal-footer button.btn, ul#child-case-tabs .dropdown-menu', function(e) {
e.stopPropagation();
});
$(document).bind('dragover drop', function(event) {
event.preventDefault();
return false;
});
$scope.$on('sp_loading_indicator', function(e, value) {
if (!value && !c.doneLoading) {
c.doneLoading = true;
}
});
}
Portal URL Link:
https://YOURINSTANCE.service-now.com/esc?id=hrm_ticket_page&table=sc_request&sys_id=SYSIDRECORD
