Client Script not working on Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 10:03 AM
Hi Experts,
I understood, that normal client scripts will not work on service portal ... I also found some posts regarding this issue, but I don't get it. How to achieve ... you anyone please tell me in more detail what to do?
My on client scripts is something like this ...
function onLoad() {
if (g_form.getUniqueValue() !== g_user.userID)
{
g_form.removeOption('u_abc', 1);
g_form.removeOption('u_def', 1);
}
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 10:31 AM
Hello,
Have you tried to set the UI type of the script to Both? Mobile and Desktop?
Cheers,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 10:33 AM
Hi Vem
According to this document
documentation/client_scripting.md at master · service-portal/documentation · GitHub
the script is absolutely ok.
Just in case i tried a similar code on my instance.
and it work fine. Please have a look to the next screenshots.
Just one thing. Did you select on the UI Type for the on Load 'Both' ?
Cheers
R0b0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 10:50 AM
In fact the UI Type was good to mention! 😉
Anyhow - it does not work. But I assume this might result due to other adjustments that where done on the widget. Have to check.
Will also check my dev instance ... if that is an home made issue ...
Thank you for the moment.
Will report back ... .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 11:12 AM
Just checked the Developer instance .... DOES not work either.
client script (on load, sys_user table, ui type both)
function onLoad() {
if (!g_user.hasRole("xxxxxxx"));
alert("Disable should be removed");
g_form.removeOption('notification', 1);
}
Added notification to portal view ....
Works fine - just NOT in Service Portal ... ;-(.
Also no Alert Message in SP