- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2017 07:26 PM
I have the following situation.
I have 2 checkboxes. One checkbox (CB1) that has a ui policy to show additional variables and other checkxbox (CB2) doesn't. What I don't know how to do is to have a checkbox unchecked if another checkbox is checked.
I have a ui policy that hides CB1 if CB2 is checked. That works fine but the problem is that if CB1 is selected and because it has a ui policy that shows additional variables, the additional variables are still visible even though CB1 is hidden.
I think I think I need to write a catalog client script for this but I am not script savvy. Please help
Here is what I which is doesn't work:
Type: onChange
Variable name: cb_2
Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == true){
g_form.setValue('cb_1' == 'false');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2017 07:37 PM
Hey Arturo,
The function is:
g_form.setValue('cb_1', 'false');
change that == to a comma and you should be OK.
You can also add a script on a UI policy, going to advanced, and adding that line whenever you want (it runs script if condition matches, and if it doesn't).
Hope it helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2017 07:37 PM
Hey Arturo,
The function is:
g_form.setValue('cb_1', 'false');
change that == to a comma and you should be OK.
You can also add a script on a UI policy, going to advanced, and adding that line whenever you want (it runs script if condition matches, and if it doesn't).
Hope it helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2017 07:45 PM
thanks so much for your help. I knew it was something simple. Also thanks for the advise about putting the script directly into the ui policy that made it easier.
I used the following in the advanced view of the ui policy that hides cb_1 when cb_2 is true:
Execute if true:
function onCondition() {
g_form.setValue('cb_1', 'false');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 01:35 PM
Hi Guillermo,
So there is a problem now. This script works fine when I put it in the advanced script section of the UI Policy but when I try to use it as a catalog client script it is still not working.
Also the UI Policy script doesn't work in the Service Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 01:44 PM
Hey Arturo,
Yes, that happens in Service Portal, I just use the on condition when the UI policy doesn't run in SP, forgot about that . Can you paste the code of the client script? That's my workaround and it should work over there.