Service Portal UI Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017 05:26 AM
Hello Community,
I've seen this question asked before and i've seen a few others similar to it. I'm trying to configure a UI Script in my Service Portal and i'm not having any luck getting it to behave as expected. I have gone into the Theme for my Portal and added a JS Include, selected my UI Script. When I call the method from the UI Script in an onLoad Client Script, nothing happens and the following message is logged to my browser console → js_includes_sp.jsx?v=05-19-2017_1034&lp=Thu_Jun_08_10_56_47_PDT_2017&c=19_473:63723 (g_env) [SCRIPT:EXEC] Error while running Client Script "Format Work Number(Default UI)": ReferenceError: helloWorld is not defined � It may be worth noting that in the default UI, I get the expected result but in the Service Portal, I do not.
This is the article I was referencing →UI Script not working in new Service Portal and I noticed b-rad mention that UI Scripts may not be supported in the Service Portal. So i'm a little confused on the direction to go here. Here is the code in my UI Script which is marked active and global...
function helloWorld(){
alert("THIS IS FROM THE UI SCRIPT");
}
Any suggestions here? Am I missing something?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017 06:26 AM
Is the Script set to All? Desktop only scripts won't run on the service portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017 06:27 AM
Yes, the Client Script is set to All. I also tried Mobile/Service Portal, same results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017 07:02 AM
So, here is a strange discovery I just made, I get the onLoad popup from the client script in Internet Explorer and another browser, but not in Chrome. I had a couple of other users test this as well and no one gets the popup in Chrome but get it in Internet Explorer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017 07:16 AM
I have had lot of inconsistency with JS alert() function when used with ServicePortal within Chrome, so as a standard, I have switched all of my alerts to gs,addInfoMessage() or gs.addErrorMessage().
This is neat..fully supported within the platform and works with itil view and portal as well.
Worth trying to validate...not sure if this is point of failure for the your UI script but worth trying if the you reference of not working is related to alert() function.