- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 12:50 AM
Hello,
Currently when I am selecting requests it shows all the details are visible in the widget (Request field). Similarly I need approver details widget for the RITM/REQ. Can you please help me out.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 06:09 PM
Create widget with below
HTML
<div ng-if="c.data.table == 'sc_req_item'" class="panel b" >
<div class="panel-heading bg-primary">Approvals</div>
<div class="panel-body">
<table class="table table-striped table-responsive" ng-if="data.approvals.length">
<thead>
<tr>
<th ng-repeat="field in data.fields_array track by $index">
<div class="th-title">{{field.label}}</div>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data.approvals track by item.sys_id">
<td class="pointer" ng-repeat="field in data.fields_array" data-field="{{field}}" data-th="{{field.label}}">{{item[field.name]}}</td>
</tr>
</tbody>
</table>
</div>
</div>
Server Script
(function() {
// Get table & sys_id
data.sys_id = $sp.getParameter("sys_id");
data.table = $sp.getParameter("table");
var approvals = [];
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", data.sys_id);
gr.addQuery('state','!=', 'not_required')
gr.query();
while (gr.next()) {
var entry = {};
entry.approver = gr.getDisplayValue('approver');
entry.state = gr.getDisplayValue('state');
entry.sys_id = gr.getValue('sys_id');
approvals.push(entry);
}
data.approvals = approvals;
data.fields_array = [
{
"name":"approver",
"label":"Approver"
},
{
"name":"state",
"label":"State"
}
];
})();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 06:09 PM
Create widget with below
HTML
<div ng-if="c.data.table == 'sc_req_item'" class="panel b" >
<div class="panel-heading bg-primary">Approvals</div>
<div class="panel-body">
<table class="table table-striped table-responsive" ng-if="data.approvals.length">
<thead>
<tr>
<th ng-repeat="field in data.fields_array track by $index">
<div class="th-title">{{field.label}}</div>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data.approvals track by item.sys_id">
<td class="pointer" ng-repeat="field in data.fields_array" data-field="{{field}}" data-th="{{field.label}}">{{item[field.name]}}</td>
</tr>
</tbody>
</table>
</div>
</div>
Server Script
(function() {
// Get table & sys_id
data.sys_id = $sp.getParameter("sys_id");
data.table = $sp.getParameter("table");
var approvals = [];
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", data.sys_id);
gr.addQuery('state','!=', 'not_required')
gr.query();
while (gr.next()) {
var entry = {};
entry.approver = gr.getDisplayValue('approver');
entry.state = gr.getDisplayValue('state');
entry.sys_id = gr.getValue('sys_id');
approvals.push(entry);
}
data.approvals = approvals;
data.fields_array = [
{
"name":"approver",
"label":"Approver"
},
{
"name":"state",
"label":"State"
}
];
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 09:27 PM
Hi Mike, Thanks for the response. I created a widget and placed in 'Ticket Form' page. But nothing showed up. Does it requires any client controller?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2018 11:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2018 05:48 AM