i want to add action widget for RITM like how we have for incident on service portal

Anil Jha
Kilo Contributor

find_real_file.png

 

 

3 REPLIES 3

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();
}
}
}

sharuq2
Tera Contributor

are you able to get the action buttons in RITM?