- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2022 12:14 AM
Hi,
I have created a variable field (Lookup select box which retrieves groups Requested-for (Variable) belongs to :
javascript: 'user=' + current.variables.requested_for_name + '^group.name!=' + ' approvers users' + '^group.active=true';
now i m trying to refresh this field when the Requested_for changes on the form, i tried some scripts but still not working.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//check to see if the value has truly changed
if (oldValue != newValue) {
//clear the value of field below
g_form.clearValue('groups');
}
}
Any idea please.??
Thank you so much
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 05:42 AM
Hi @Nawal ,
isTemplate will not be available on catalog client script but which is in your script if you remove that it will work. refer my response
If your issue got resolved close the question by Accepting solution and hit thumb icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2022 06:23 AM
Hi @Nawal ,
isTemplate method will not available on onchnage catalog client script but in your script I saw that method.
May be that is the it is not working.
So use same script which I provided below
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
if (oldValue != newValue) {
g_form.setValue('groups', '');
}
}
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2022 05:42 AM
Hi @Nawal ,
isTemplate will not be available on catalog client script but which is in your script if you remove that it will work. refer my response
If your issue got resolved close the question by Accepting solution and hit thumb icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 09:26 PM
HI @Nawal ,
If your issue got resolved close the question by Accepting solution and hit thumb icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar