- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2025 12:45 PM - edited 05-09-2025 12:52 PM
Coming from this discussion, where I am experiencing something similar, but not exactly. I am testing this on a PDI and it is doing the exact same thing as in my environment.
var max = 5;
Object.assign(data, {
items: [{
title: gs.getMessage("View All Active Incidents"),
type: "link",
href: "/",
items: []
}],
count: 1,
});
var incident = new global.GlideQuery("incident")
.where("active", true)
.limit(max)
.select("short_description", "number", "sys_updated_on", "sys_class_name")
.toArray(max)
.forEach(function(result) {
Object.assign(result, {
__table: result.sys_class_name,
__page: "ticket",
type: "record",
});
data.items.push(result);
data.count++;
});
Symptoms
It builds the menu, but the text for the link type is missing.
When I inspect with dev tools and hover over the items, there is text missing.
Indeed, when I look at the generated source, there is no text!
I feel like this is probably the dumbest question ever, but, wow, this is just not working for me.
Additionally, it is clickable. Doing so will bring exactly where it should. Just... maybe, I can make a lottery out of it. 🤔
This works PERFECTLY FINE in regular SP. 😢
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2025 11:59 PM
Hello @Brian Workman ,
Please change the first part of the script as follows:
var max = 5;
Object.assign(data, {
items: [{
name: gs.getMessage("View All Active Incidents"),
type: "url",
href: "/incident_list.do",
url_target: "_BLANK",
items: []
}],
count: 1,
});
So instead of "title" the property needs to be named "name".
And the value of the "type" property needs to be changed from "link" to "url".
The "url_target" is optional. I just added it to illustrate how the link can be opened in a new tab.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2025 11:59 PM
Hello @Brian Workman ,
Please change the first part of the script as follows:
var max = 5;
Object.assign(data, {
items: [{
name: gs.getMessage("View All Active Incidents"),
type: "url",
href: "/incident_list.do",
url_target: "_BLANK",
items: []
}],
count: 1,
});
So instead of "title" the property needs to be named "name".
And the value of the "type" property needs to be changed from "link" to "url".
The "url_target" is optional. I just added it to illustrate how the link can be opened in a new tab.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2025 10:23 AM
Amazing. I must have missed something because I am confident that it was title and link.
In fact, re-visiting the Angular ng-template (https://instance.service-now.com/sp_ng_template.do?sys_id=492127b05b301200e39fc7ad31f91a50), there isn't a type == 'url', so this is very confusing.
The difference between
{
title: "View All Active Incidents",
type: "link",
href: "/incident_list.do",
items: []
}and
{
name: "View All Active Incidents",
type: "url",
href: "/incident_list.do",
items: []
}is non-trivial.
It is a little frustrating that I can’t seem to find any official documentation that outlines what the structure is supposed to be for either version. Not for Service Portal, and certainly not for Employee Center. No schema, no field definitions, not even a buried JSON example. Just scattered community posts and your help, which I appreciate enormously. 🙂
Is there a canonical reference anywhere for this? If the EC version expects a completely different object shape, that's fine — but it'd be great to have that documented somewhere.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2025 11:01 AM
Hello @Brian Workman ,
Unfortunately, I'm not aware of any official documentation.
I had to figure out the answer by looking at the code of the Employee Center Navigation Widget.
https://instance.service-now.com/nav_to.do?uri=sp_widget.do?sys_id=045301ddeb503010ed7966d647522844
Regards,
Robert