- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2016 07:26 PM
Hi all,
Our Pilot users have discovered that when they do not have any active tickets, they cannot go in and see their inactive tickets
After all requests / incidents are closed, the menu item disappears.
Is there a way to make the menu item stay visible, even when there are no active tickets?
The code for the menu item (this is OOB)
var t = data; // shortcut
t.items = [];
t.count = 0;
var u = gs.getUser().getID();
// use record watchers to tell header when to update dropdown counts
t.record_watchers = [];
t.record_watchers.push({'table':'service_task','filter':'active=true^opened_by=' + u});
t.record_watchers.push({'table':'incident','filter':'active=true^caller_id=' + u});
t.record_watchers.push({'table':'sc_request','filter':'active=true^requested_for=' + u});
var st = new GlideRecord('service_task');
if (st.isValid()) {
st.addActiveQuery();
st.addQuery('opened_by', gs.getUserID());
st.orderByDesc('sys_updated_on');
st.query();
while (st.next()) {
var a = {};
$sp.getRecordValues(a, st, 'short_description,sys_id,number,sys_updated_on');
if (st.short_description.nil())
a.short_description = "(No description)";
a.__table = st.getTableName();
a.type = 'record';
a.sortOrder = st.sys_updated_on.getGlideObject().getNumericValue();
t.items.push(a);
t.count++;
}
}
var z = new GlideRecord('incident');
z.addActiveQuery();
z.addQuery('caller_id', gs.getUserID());
z.orderByDesc('sys_updated_on');
z.query();
while (z.next()) {
var a = {};
$sp.getRecordValues(a, z, 'short_description,sys_id,number,sys_updated_on');
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);
t.count++;
}
var z = new GlideRecord('sc_request');
z.addActiveQuery();
z.addQuery('requested_for', gs.getUserID());
z.orderByDesc('sys_updated_on');
z.query();
while (z.next()) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', z.getUniqueValue());
ritm.query();
if (!ritm.next())
continue;
var a = {};
$sp.getRecordValues(a, z, 'sys_id,number,sys_updated_on');
if (ritm.hasNext())
a.short_description = ritm.getRowCount() + ' requested items';
else
a.short_description = ritm.cat_item.getDisplayValue() || ritm.getDisplayValue("short_description");
a.__table = z.getTableName();
a.type = 'request';
a.sortOrder = z.sys_updated_on.getGlideObject().getNumericValue();
t.items.push(a);
t.count++;
}
t.items.sort(function(a, b) {
return b.sortOrder - a.sortOrder;
});
var link = {};
link.title = gs.getMessage('View all requests');
link.type = 'link';
link.href = '?id=requests';
link.items = [];
t.items.unshift(link); // put this first
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2016 12:43 AM
item.showAlways should probably be item.scriptedItems.showAlways
When you declare property in a javascript object, it will be created. You don't have to worry about the property already existing.
If you want to be sure that the property actually exist you could do a console.log("MY DEBUG: " + item.scriptedItems.showAlways);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 05:50 AM
Also, is it by any chance possible to alter the request number visible on the portal to the RITM number?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:52 AM
Again, please start a separate thread, as this is not related.
However, Both yes and no.
Request and request item isn't necessarily a 1 to 1 relation, so no, you cannot.
Think of the request as a representation of your shopping cart, then the request items are all the items included inside of it.
However, what you can do, is to list all the request itmes in this widget, instead of the requests.
But be aware that this might get more complicated than expected, as you're actually changing the intended structure of the request flow.
The best solution is usually to stick with the out of the box version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:04 AM
I think you're referring to the widget for tickets on the potal home page and not the menu item anymore..
Having said so, this is a bit of topic here... you should create a separate thread for this one.
anyway, just hold ctrl and right click this widget (or anywhere on the page actually)
then from the pop up menu select page designer.
form here you should see all the widget for this page, click the pencil icon in the right corner of the given widget.
then you should se a dialog having a field for: "display field", also see: "secondary fields", these are the fields you would like to modify.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 06:55 AM
ok, it might be display name then, I could have repeated/memorized it incorrectly, try changing this one to what you desire.