Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How To Remove form header breadcrumbs?

kchisefsky
Mega Contributor

I am using CMS to create a custom site and have a need to remove the standard breadcrumbs from the form header (not the list filter) if forms and catalog items.   I was successful for the incident form using an onLoad client script, obtaining the element id "form_header" and setting visibility to false. However, I need to do this for all catalog items (several hundred) and I don't want to create a client script of each one. So is there a global way to remove the standard OOTB breadcrumbs?

1 ACCEPTED SOLUTION

Slava Savitsky
Giga Sage

To avoid creating a client script for each catalog item, use a global UI script instead. It will run on every page in the system. You can use location.href to check if current page is "com.glideapp.servicecatalog_cat_item_view" and if it is — hide the DOM element that contains breadcrumbs. Something along these lines:



(function() {


  addLoadEvent(function() {


          if(location.href.indexOf('/ess/com.glideapp.servicecatalog_cat_item_view.do') != -1 {


              gel('your_element_id').hide();


          }


  });


})();


View solution in original post

11 REPLIES 11

Thanks David. I set the property to false but the breadcrumbs still appear. We are running the Dublin release, patch 6 I think. I wonder if this is a Eureka feature? What are you running?


Slava Savitsky
Giga Sage

To avoid creating a client script for each catalog item, use a global UI script instead. It will run on every page in the system. You can use location.href to check if current page is "com.glideapp.servicecatalog_cat_item_view" and if it is — hide the DOM element that contains breadcrumbs. Something along these lines:



(function() {


  addLoadEvent(function() {


          if(location.href.indexOf('/ess/com.glideapp.servicecatalog_cat_item_view.do') != -1 {


              gel('your_element_id').hide();


          }


  });


})();


Many thanks for this tip, Slava. i had the same requirement of hiding the breadcrumbs on particuler ESS pages, and this did the trick!


nancyhz
Mega Contributor

Hi Slava



I am new to UI Script. Since we hide breadcrumbs so in your code, we mentioned 'you_element_id, is that id of breadcrumbs, right?     I know how to identify Catalog item form element id, but I had hard time to identify element id for breadcrumbs.   If I am wrong, can you give me more information.



Thanks


Here's the UI Script I used to hide breadcrumbs:



/***** Hide classic UI Breadcrumbs *****/


// when x = MLDivElement, get element by Id and hide standard breadcrumbs


x=document.getElementById("form_header");



if (x != null && x != "" && x != "undefined" && (typeof x != "undefined")) {


document.getElementById("form_header").style.visibility = "hidden";


}



Kathy Chisefsky


Web Developer


ActioNet, Inc.


20300 Century Boulevard, Suite 200


Germantown, MD 20874


Phone: 301-944-5681