- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2018 05:59 PM
Hello,
I've noticed that when looking up requests in the Service Portal, it's actually pretty hard to find the status without actually opening the record. These are places I would like to see status:
- Simple List on Requests page
- Header Menu - Requests scripted list
- Data Table from URL Definition widget (clicking View All from Simple List)
The only one I've been successful with is the Simple List widget (or, rather, the clone that I'm using). That was a simple matter of adding it to the 'secondary fields' option for each widget instance.
The other two are driving me crazy! I am pretty confused about how the Data Table from URL Definition widget works, as the same widget instance is used for everything and it's settings are for Incident. I have not been able to add an additional column (status/state) to this. It only ever shows 4 default columns that I can't see are configured anywhere.
I've made slightly more progress with the header menu, but am hitting a wall. So far, I've been able to add the state, but I'm getting the numerical value and not the display value. I have no idea how to get this to display correctly. I'm fumbling my way through widget coding, but for the most part I'm just guessing and trying whatever comes to mind.
To get here, I added 'state' to the scripted list 'Requests' for each table that's queried, and then added "• {{mi.state}}" to the template. I can convert this to the display value within the scripted list (confirmed with console.log), but have no idea how to call that up from the template.
Example:
Requests Scripted List (added 'state' on line 9):
var z = new GlideRecord('incident');
z.addActiveQuery();
z.addQuery('caller_id', gs.getUserID());
z.orderByDesc('sys_updated_on');
z.setLimit(max);
z.query();
while (z.next()) {
var a = {};
$sp.getRecordValues(a, z, 'short_description,sys_id,number,sys_updated_on,state');
if (z.short_description.nil())
a.short_description = "(No description)";
a.__table = z.getTableName();
a.type = 'record';
a.sortOrder = z.sys_updated_on.getGlideObject().getNumericValue();
t.items.push(a);
}
spDropdownTreeTemplate (added on line 7):
<a ng-if="mi.type == 'record' && !mi.__page" title="{{mi.short_description}}" href="?id=ticket&table={{mi.__table}}&sys_id={{mi.sys_id}}">
<span>{{mi.short_description | characters:60}}</span>
<span class="block color-primary text-muted">
<span class="block" style="float: right">
<sn-time-ago timestamp="mi.sys_updated_on" />
</span>
{{mi.number}} • {{mi.state}}
</span>
</a>
Thoughts/ideas?
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2018 07:12 PM
hi Matthew,
out of the first glance, u can try:
1. Remove the 'state' field on line 09.
2. Add the following line before t.items.push(a);
a.state = z.getDisplayValue('state');
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2018 07:12 PM
hi Matthew,
out of the first glance, u can try:
1. Remove the 'state' field on line 09.
2. Add the following line before t.items.push(a);
a.state = z.getDisplayValue('state');
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2018 07:23 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2018 10:04 AM
Yup, that did it! Thanks for the quick assist.
Any ideas on the Data Table widget? Guessing I'll have to clone that one to get anywhere.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2018 02:53 PM