i want to add action widget for RITM like how we have for incident on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 09:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 09:58 AM
Hi,
Refer below article might be helpful to you
https://serviceportal.io/create-custom-action-buttons-service-portal/
https://www.servicenowelite.com/blog/2017/5/12/service-portal-resolve-incident-button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 10:16 AM
I have tried the above link but it's not working please help me with the server side script
Html :
<div class="panel panel-default">
<div class="panel-heading">Actions</div>
<div class="panel-body">
<button type="button" class="btn btn-primary btn-block" ng-click="c.uiAction('resolve')">Yes</button>
<button type="button" class="btn btn-default btn-block" ng-click="c.uiAction('cancel')">No</button>
</div>
</div>
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;
if (input && input.action) {
var action = input.action;
// If Incident table
if (data.table == 'sc_task') {
if (action == 'yes') {
alert('abc');
// Resolve Incident
gr.setValue('task_state', 3);
gr.setValue('state', 3);
gr.setValue('resolved_by', gs.getUserID());
gr.update();
}
if (action == 'no') {
alert("xyz");
gr.setValue('task_state', 8);
gr.setValue('state', 8);
gr.setValue('resolved_by', gs.getUserID());
gr.update();
}
}
}
})();
client controller:
function link(scope, element, attrs, controller) {
scope.setFocusOnActionButtons = function() {
if (scope.widget.isFocusRequired) {
var elm = element.find('#actions-button')[0];
elm.focus();
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 05:45 AM
are you able to get the action buttons in RITM?