- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 03:34 AM
if (isLoading || newValue == '') {
return;
}
var abode = g_form.getValue('acrobat');
var photo = g_form.getValue('photoshop');
if (abode == 'true') {
g_form.setValue('laptop', 'true');
g_form.setVisible('desktop', 'false');
} else if (abode == 'true' && photo == 'true') {
g_form.setVisible('desktop', 'true');
g_form.setVisible('laptop', 'true');
g_form.setValue('laptop', 'true');
g_form.setValue('desktop', 'true');
} else {
g_form.setValue('laptop', 'false');
g_form.setVisible('desktop', 'true');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 04:53 AM
Hi @Satyapriya
You should write most generic case in separate if-else loop like below.
if (abode == 'true') {
g_form.setValue('laptop', 'true');
g_form.setVisible('desktop', 'false');
} else {
g_form.setValue('laptop', 'false');
g_form.setVisible('desktop', 'true');
}
if (abode == 'true' && photo == 'true') {
g_form.setVisible('desktop', 'true');
g_form.setVisible('laptop', 'true');
g_form.setValue('laptop', 'true');
g_form.setValue('desktop', 'true');
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 06:53 AM
We have to write two onchange client script
One is for change of abode and other one is for change of photoshop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 04:53 AM
Hi @Satyapriya
You should write most generic case in separate if-else loop like below.
if (abode == 'true') {
g_form.setValue('laptop', 'true');
g_form.setVisible('desktop', 'false');
} else {
g_form.setValue('laptop', 'false');
g_form.setVisible('desktop', 'true');
}
if (abode == 'true' && photo == 'true') {
g_form.setVisible('desktop', 'true');
g_form.setVisible('laptop', 'true');
g_form.setValue('laptop', 'true');
g_form.setValue('desktop', 'true');
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 05:53 AM
Thanks Vishal ,
This is working properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 01:59 AM
Hi,
On which variable we have to write the on change client script. Is it adobe?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 06:53 AM
We have to write two onchange client script
One is for change of abode and other one is for change of photoshop