Creating Button in Employee Center Header
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 03:07 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2023 05:29 AM
Hi @Dom_Che ,
Refer to this Solution :https://www.servicenow.com/community/itsm-forum/how-can-we-create-a-button-field-on-header/m-p/64857...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 01:51 AM
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
ServiceNow Consultant
United Kingdom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2023 03:25 AM - edited 05-15-2023 03:27 AM
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