- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 02:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 05:32 AM
Hi,
here you are not setting the approval value properly
jr.setValue('approval', 'requested');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2020 03:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2020 05:40 AM
Hi Sravani,
the page you are showing is ticket page.
sharing few links on how to add button on ticket page
Is it possible to have UI Actions on the ticket portal page?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 12:03 AM
Hi Ankur,
We have gone through it and first we checked it for incident table then it is working but when we glide that table to request item it is getting an error..
HTML
<div class="panel panel-default">
<div class="panel-heading">Actions</div>
<div class="panel-body">
<button type="button" class="btn btn-default btn-block" style="background-color:Cyan;color:Black" ng-click="c.uiAction('cancel')">Cancel </button>
</div>
</div>
CLIENT SCRIPT
function ($uibModal, $scope, spUtil) {
var c = this;
$scope.$on('record.updated', function(name, data) {
spUtil.update($scope);
});
c.uiAction = function(action) {
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
spUtil.addInfoMessage("RITM has been Cancelled", 3000);
});
c.modalInstance.close();
};
c.openModalResolve = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplateResolve',
scope: $scope
});
};
c.closeModal = function() {
c.modalInstance.close();
};
}
SERVER SCRIPT
(function() {
// Get table & sys_id
data.table = input.table || $sp.getParameter("table");
data.sys_id = input.sys_id || $sp.getParameter("sys_id");
// Valid GlideRecord
var gr = new GlideRecord(data.table);
if (!gr.isValid())
return;
// Valid sys_id
if (!gr.get(data.sys_id))
return;
//Button Visibility
if(data.table == 'sc_req_item' && gr.approval==requested&& (gr.u_requested_for == gs.getUserID() || gr.opened_by == gs.getUserID())){
data.showWidget = true;
data.showResolve = true;
} else {
data.showWidget = false;
data.showResolve = false;
}
//input
if (input && input.action == 'CancelRITM') {
// If Requested item
if (data.table == 'sc_req_item') {
var jr = new GlideRecord('sc_req_item');
jr.get(data.sys_id);
jr.setValue('approval', requested);
jr.setValue('state', 4);
jr.update();
}
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 02:03 AM
Hi,
I would suggest to create new question for this so that others are not confused as this question is already answered.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 05:32 AM
Hi,
here you are not setting the approval value properly
jr.setValue('approval', 'requested');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader