How to hide child topics in employee center mega menu

mtymytk
Tera Expert
Hi,

I would like to hide the topics on the 3rd level of the Employee Center mega menu.
For example, in the attached image, I want to display up to Hardware, Software, Network which are child topics of IT but not Computers and any other below Computers.
 
image.png 

 

 

reference:
17 REPLIES 17

Nishant12
ServiceNow Employee
ServiceNow Employee

To show only root level of topics and its child , we will have to clone the widget Employee Center Navigation (employee-center-navigation) and change the server script in the cloned widget from

"megaMenuTopics = portalTaxonomy.getTopics(true, 2, false);"

to 

"megaMenuTopics = portalTaxonomy.getTopics(true, 1, false);"

 

The second parameter in the getTopics determine how many levels of topics should the menu display . 

 

This change will only hide the menu items in the mega menu, but they will still appear when you navigate to thier parent topic 

Nishant12_0-1697733579260.png


After the cloned widget is saved with the changes name of cloned widget : cloned-employee-center-navigation 

 

We need to associate it to the employee center header which acts as main header . 

Open Widget Employee Center Header (employee-center-header) and in the server script change the widget id of employee center navigation to newly cloned widget with changes . 

Nishant12_1-1697733889735.png

 

Logout and login to employee center , you will only see 1 level of topics in menu of employee center . 

 

@MichaelCreatura  @mtymytk 

Hi @Nishant12 

I followed your steps but I am getting some errors, please advise:

MichaelCreatura_0-1697790160148.png

MichaelCreatura_1-1697790193027.png

 

Thanks,

 

 

 

Hi @MichaelCreatura , 
You will have to allow RCA's , 
Navigate to  Restricted called access "https://<instance-url>/sys_restricted_caller_access_list.do?sysparm_userpref_module=87476f8667000300...

replace <instance-url> with your instance URL .

There will be RCA records with the status set as "Invalidated" open them and change the status to allowed and save them . 

Or 

If you have access to run the background script or create a fix script run the below query. 

 

 

 

 

var gr = new GlideRecord('sys_restricted_caller_access');
gr.addQuery('status’,'IN’,'0,3’);
gr.query();
while(gr.next()) 
{
gr.setValue('status','2');
gr.update();
}

 

 

 Please mark the answer as helpful if it helped you achieve what you need. 

 

Thanks @Nishant12 - that fixed the issue with the errors. 

 

It still doesn't look like those steps worked for the main question of hiding Child Topics as when I do it and allow the restricted caller access it shows no navigation menu on the ESC. 

Can you add screenshots of your changes and the Employee Center menu UI after the changes so that I can review if there is anything that's missed? 

 

@MichaelCreatura