- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2015 03:20 AM
Below is the code for setting value.
function onChange() {
if (g_form.getValue('variables.UserType') == 'Terminal Server Users')
{
g_form.setValue('variables.OutlookEmail',true);
g_form.setValue('variables.ServiceNowAccount',true);
g_form.setValue('variables.TerminalAccess',true);
}
}
When I keep alerts it is showing as true but on the form check box is not getting ticked.
Please help what is missing
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2015 10:46 PM
Hi All,
Now it is working after modifying as below.
function onChange() {
//var user = g_form.getValue('variables.UserType');
if (g_form.getValue('UserType') == 'Terminal Server Users')
{
g_form.setValue('OutlookEmail','true');
g_form.setValue('ServiceNowAccount','true');
g_form.setValue('TerminalAccess','true');
}
else if (g_form.getValue('UserType') == 'External Users with Archroma Laptop')
{
g_form.setValue('OutlookEmail','true');
g_form.setValue('ServiceNowAccount','true');
g_form.setValue('TerminalAccess','false');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2015 03:40 AM
Hi,
You don't need the "variables" part in your setValue, your code should look like: -
function onChange() {
if (g_form.getValue('variables.UserType') == 'Terminal Server Users')
{
g_form.setValue('OutlookEmail',true);
g_form.setValue('ServiceNowAccount',true);
g_form.setValue('TerminalAccess',true);
}
}
Please mark your answer as helpful or correct if this has worked.
Thanks,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2015 10:05 PM
Not working Daniel.
function onChange() {
//var user = g_form.getValue('variables.UserType');
if (g_form.getValue('variables.UserType') == 'Terminal Server Users')
{
g_form.setValue('OutlookEmail',true);
alert(g_form.getValue('variables.OutlookEmail'));
g_form.setValue('ServiceNowAccount',true);
g_form.setValue('TerminalAccess',true);
}
else if (g_form.getValue('variables.UserType') == 'External Users with Archroma Laptop')
{
alert('external');
g_form.setValue('OutlookEmail',true);
g_form.setValue('ServiceNowAccount',true);
g_form.setValue('TerminalAccess',false);
alert(g_form.getValue('variables.TerminalAccess'));
}
}
I kept alerts and they are popping up correctly but checkboxes are not getting checked. Please let me know what I am missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2015 07:25 AM
Hi Mounika,
you can use catalog client script to do this,
Creating a Catalog Client Script - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2015 07:46 AM
Hi Mounika,
Just remove the variables from your code and it should work.
ex: g_form.setValue('OutlookEmail',true); //Assuming OutlookEmail is the name of the variable.