
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 04:54 AM
Breadcrumb navigation on Employee Center Portal is confusing and actually decreases usability. Is there a way to make all content appear in a consistent taxonomy so that breadcrumb navigation matches the mega menu?
Use Case As-Is
- Open Topic Page from Mega menu
- The breadcrumb reflects the content taxonomy
- Click on the catalog item
- The breadcrumb navigation changes to different taxonomy - a technical structure of catalogs
Use Case To-Be
- Open Topic Page from Mega menu
- The breadcrumb reflects the content taxonomy
- Click on the catalog item
- The breadcrumb navigation remains consistent, adds the final child item
Solved! Go to Solution.
- 3,748 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2023 08:42 AM - edited ‎04-19-2023 08:46 AM
Hello @Peter Zalman, how are you?
I am implementing an employee center and I faced the same problem.
I needed to create a custom widget to have this functionality using a function that ServiceNow itself uses to generate the breadcrumb of the taxonomies.(function present in the topics page)
There are some business rules for the operation of this widget, they are:
- Does not work if two topics are using the same item
- Does not work using content items
- If it doesn't find the breadcrumb, it will just be Home > Catalog Item Name.
How to implement:
- Install the attached widget.
- Go to Service Portal > Pages > esc_sc_cat_item
- Click on the instance where the HRM Back Button ( is on the instance and not on the widget name)
- Go to the Section Widget and change the widget to the breadcrumb taxonomy
Now where the back button widget will be replaced by the custom breadcrumb to show the taxonomy path to the catalog item.
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at Nuvolax
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2023 08:45 AM
Feel free to look at my widget and implement it in your instance.y
Any tips or feedback are most welcome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2024 05:23 AM
Great widget @Vanderlei ! I tested it in my PDI, but I didn't get it to work for catalog items mapped to multiple topics. It displayed the breadcrumbs from the first topic that it was tagged to. The topic in the taxonomy topic-field on catalog item, that breadcrumb was displayed.
Have you seen this as well? Any thoughts on how to fix it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2025 07:32 AM
Unfortunately this is a problem.
This widget look to the taxonomy field on the catalog item,
I will try to upgrade this widget and then I share here ok?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2025 11:06 PM
I updated the server script to the following code to at least filter it down to one taxonomy (based on portal) and on top to (as an option) receive an additional topic_id parameter to override the behaviour of going for the first match:
(function() {
function getSPParam(name) {
var param = $sp.getParameter(name);
if (param) param = (param + "").trim();
return param;
}
data.breadcrumbs = [];
var topicId = (input && input.topic_id) || options.topic_id || $sp.getParameter("topic_id");
if (topicId) topicId = topicId + "";
function getRootTaxonomies(portalGR) {
var taxonomies = [];
var grM2mSpPortalTaxonomy = new GlideRecord('m2m_sp_portal_taxonomy');
grM2mSpPortalTaxonomy.addEncodedQuery("sp_portal=" + portalGR.sys_id + "^active=true^taxonomyISNOTEMPTY");
grM2mSpPortalTaxonomy.orderBy('order');
grM2mSpPortalTaxonomy.setLimit(10);
grM2mSpPortalTaxonomy.query();
while (grM2mSpPortalTaxonomy.next()) {
taxonomies.push(grM2mSpPortalTaxonomy.taxonomy.sys_id + "");
}
if (taxonomies.length > 0) return taxonomies;
return false;
}
function getContent(page, rootTaxonomies, topicId) {
if (page, rootTaxonomies && rootTaxonomies.length > 0) {
var query = false;
var topicQuery = false;
if (topicId) {
var grTopic = new GlideRecord('topic');
if (grTopic.get(topicId)) {
topicQuery = "topic=" + topicId;
}
}
if (!topicQuery) {
topicQuery = "topicISNOTEMPTY";
}
switch (page) {
case "sc_cat_item":
var catItem = getSPParam("sys_id");
if (!gs.nil(catItem)) {
query = "catalog_item=" + catItem;
}
break;
case "kb_article":
var kb = getSPParam("sys_id");
if (!gs.nil(kb)) {
query = "knowledge=" + kb;
}
break;
default:
//ignore (for now?!)
}
if (query) {
var grM2mConnectedContent = new GlideRecord('m2m_connected_content');
grM2mConnectedContent.addEncodedQuery(query + "^" + topicQuery + "^topic.taxonomyIN" + rootTaxonomies.join(","));
grM2mConnectedContent.orderBy('order');
grM2mConnectedContent.setLimit(10);
grM2mConnectedContent.query();
if (grM2mConnectedContent.next()) {
return grM2mConnectedContent;
}
}
}
return false;
}
function getLabel(contentGR) {
if (contentGR) {
var label = false;
if (contentGR.catalog_item) {
label = contentGR.catalog_item.getDisplayValue('name');
}
if (contentGR.knowledge) {
label = contentGR.knowledge.getDisplayValue('short_description');
}
if (label && !gs.nil(label)) {
return {
"label": label + "",
"url": "#"
};
}
}
return false;
}
var page = getSPParam("id");
var portalGr = $sp.getPortalRecord();
var taxonomies = getRootTaxonomies(portalGr);
if (topicId) {
var grTopic = new GlideRecord('topic');
if (!(taxonomies && grTopic.get(topicId) && grTopic.taxonomy && taxonomies.includes(grTopic.taxonomy.sys_id + ""))) {
topicId = false;
}
}
var content = getContent(page, taxonomies, topicId);
if (content) {
try {
var breadcrumbs = new sn_ex_sp.TopicPageUtil().fetchBreadCrumbsForTopic(content.topic.sys_id + "");
breadcrumbs.push(data.breadcrumbs.pop());
if (!breadcrumbs[breadcrumbs.length - 1]) breadcrumbs.pop();
var label = getLabel(content);
if (label) breadcrumbs.push(label);
data.breadcrumbs = breadcrumbs;
} catch (e) {
gs.error(e.getMessage());
gs.addErrorMessage(gs.getMessage("Error occurred, please refer logs for information"));
}
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2025 11:00 PM
@Vanderlei can you suggest what I should do to have the HRM Back button instead of the breadcrumbs for sc_cat_item page for a specific portal. My requirement is to have the back button for a specific portal and breadcrumbs for all the remaining portals that uses the same page