Creating Button in Employee Center Header

Dom_Che
Tera Contributor

Hello everyone. 
I struggle with creating a button in Employee Center Header.

 

The button is supposed to:

1. Be visible only if user has an ITIL or Admin role

2. Be called "Backend" and send user to the NOWPlatform on click. 

 

I managed to create the button itself, but I am unable to call in a function I created in the Server Script that evaluated the instance name, and based on the name would give out a different URL. 

 

Does anyone has an idea how to create such button?

3 REPLIES 3

Community Alums
Not applicable

Sails
Kilo Sage

Hi @Dom_Che : Were you able to find out the solution for this?

I've been working on the same requirement and couldn't get enough insights

Best

Sails
ServiceNow Consultant
United Kingdom

Dom_Che
Tera Contributor

Yes @Sails ! Maybe this will give you some insight:

In Service Portal > Headers & Footers > "Your Relevant Header Record"

1. HTML: code for the button itself. You have to add it in the right place and potentially modify it - depending on your need. In our case it was in the right-top corner.

<li class="main-header-item" ng-if="data.showBackendLink" role="menuitem">
    <a href="/" id="backend_link" aria-label="${BackEnd}" role="menuitem">
        <span ng-bind-html="'${BackEnd}'">
        </span>
    </a>
</li>

2. Server script - checks if person has admin and/or itil role:

data.showBackendLink = false;
var vUser = gs.getUser();
if(vUser.hasRole('admin') || vUser.hasRole('itil'))
   data.showBackendLink = true;

So the button will show only to people wth admin and/or itil role