UI Script is not working in Polaris?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 02:56 AM
Hi All,
I have created one UI Script to show the 'switch to portal' option below the user dropdown on the home page. It's working fine in UI16 but it's not working in Polaris UI. Below is my code.
(function(){
addLoadEvent(function(){
try{
var addItem = (window.top.$j("#custom_menu_item_1").length == 0);
if (g_user.hasRoles() && addItem) {
var menuItem = "<li><a id='custom_menu_item_1' href='/sp' target='_blank'>" + getMessage("Switch to Portal") + "</a></li>";
var menuList = window.top.$j("ul.dropdown-menu");
if(menuList.length >= 0){
window.top.$j("ul.dropdown-menu li:eq(0)").after(menuItem);
}
}
}catch(e){
}
});
})();
Please suggest me on this. Thank You!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 03:01 AM
HELLO
its only possible in UI 16 and as of now there is no work around that i can see
please mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 03:03 AM
Hi,
This article will https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1116237 help you understand.
Hopefully, it will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 03:18 AM
wow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 03:53 AM
I am trying to add one option under the user profile but i am not sure, how I can use client script to call the UI Script which i have createdd.
Thanks in advance.
Regards,
Ganesh