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-28-2017 08:53 AM
Still not working.
Alter shows nothing if field empty and the date in case field filled - so this should be ok, just the g_form.setDisplay('u_xxx', false) does not work for empty.
For bolean fields it does not show anythin via the altert - neither with or without .toString()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 09:08 AM
Hi Vem
It doesn't sound good.
I tried on my instance your code with a true/false field on the asset table
It works fine.
Have a look.
Are you sure you have that field (u_xxx) on the form ?
What's the type of that field (u_xxx) ?
Are you sure there isn't another client script messing around with that field ?
Did you check if the field is mandatory ?
Cheers
R0b0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 02:24 PM
Are you sure you have that field (u_xxx) on the form ?
>>> yes
What's the type of that field (u_xxx) ?
>>> date
Are you sure there isn't another client script messing around with that field ?
>>> if so, it would not force any other action - BUT I have ui-policies that do the same as the client script, just they do not work either ... if I disable the Clients Script, the ui_policies do NOT apply ...
Did you check if the field is mandatory ?
>>> no is not mandatory (but read only)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2017 02:42 PM
Hi Vem
It wasn't clear it was a date.
Try this one than
function onLoad() {
alert('u_xxx is ' + g_form.getValue('u_xxx'));
if (g_form.getValue('u_xxx').toString() === '') { /
g_form.setDisplay('u_xxx', false); // Hide
}
}
For a date that syntax doesn't make sense. It won't work.
On the other hand if you can convert the date to a string and the string is empty the code between the if should be finally triggered.
ps i tested on my instance first..it should work on the portal as well
Cheers
R0b0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2017 12:44 PM
I have noticed that g_user is not listed in the support and unsupported scripts at all. Supported and unsupported client scripts