- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 12:54 PM
Hey all, for whatever reason, UI policies to hide a checkbox will not work in our dev (Helsinki) or prod (Fuji) environments. So, I tried to create a client script to show the field "fast_corp" if the user's department in the "requested_for" field matches one of the four in the script. If not, hide the icon. So by default, the icon should be hidden until a user with one of the four departments matches the script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var user = g_form.getValue('requested_for');
if (user.department == "IT DEPARTMENTS" || user.department == "FINANCE DEPARTMENTS" || user.department == "Finance" || user.department == "SUPPLY") {
g_form.setVisibile('fast_corp', 'true');
}
else {
g_form.setVisible('fast_corp');
}
}
I assume the dotwalking with the user variable didn't work. Also, I tried removing the department condition and simply entered myself as the user and the checkbox was still showing up, no matter what user was entered.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 02:50 PM
Moreover I have noticed that your onChange script is on fast_corp variable name. It should be on requested_for not fast_corp.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 12:58 PM
Here you go.try this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var user = g_form.getReference('requested_for',CallBack);
function CallBack(user){
if (user.department == "IT DEPARTMENTS" || user.department == "FINANCE DEPARTMENTS" || user.department == "Finance" || user.department == "SUPPLY") {
g_form.setDisplay('fast_corp', true);
}
else {
g_form.setDisplay('fast_corp',false);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 01:03 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 12:59 PM
You will also need an onLoad script and put this script in there
var user = g_form.getReference('requested_for',CallBack);
function CallBack(user){
if (user.department == "IT DEPARTMENTS" || user.department == "FINANCE DEPARTMENTS" || user.department == "Finance" || user.department == "SUPPLY") {
g_form.setDisplay('fast_corp', true);
}
else {
g_form.setDisplay('fast_corp',false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2016 01:07 PM
Added this and it's onLoad client script as well, still no luck.
Why are the UI Policies not working? This is way more complicated than it needs to be, but I appreciate your help as always.