- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 11:33 AM - edited ‎04-22-2025 11:35 AM
I have a Script that I need help with. I have this to load the CI Support group based on the that CI. But groups no longer want to get these for some. SO I have a value on the Group called u_no_generic_request and it's set to true for the group that don't want to get them. I am trying to have it look at that field if that is set to 'true' then don't autoload the support group but if it's 'false' then it can. This script though is saying they are all set to generic no matter what i pick. I know i have something wrong I am just not sure what. TIA
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '') {
g_form.setValue('support_group', '');
return;
}
if (!g_form.getControl('support_group')) {
return;
}
var group = g_form.getReference('support_group');
if (group && group.u_no_generic_requests === false) {
g_form.setValue('support_group', newValue);
} else {
g_form.clearValue('support_group');
alert('The selected group does not accept Generic Service Requests and cannot be set as the support group.');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 11:45 AM - edited ‎04-22-2025 12:00 PM
Hello @Wendy Peterson ,
I understand you have a variable for selecting a CI and a variable for a Support group on your Catalog Item.
Which of these two variables is this onChange Script running on?
Assuming it's an onChange of the Support group variable, the script would need to look like this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.getReference('support_group', group => {
if (group && group.u_no_generic_requests === 'false') {
g_form.clearValue('support_group');
g_form.showErrorBox('support_group', 'The selected group does not accept Generic Service Requests and cannot be set as the support group.');
}
});
}
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 12:15 PM
Hello @Wendy Peterson ,
This script is not necessary. Please see my reply from a few minutes ago for details. The solution outlined there is all you need and I have verified on my end that it works.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 12:23 PM
This works i just created another script to run after the first. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2025 12:32 PM
Hello @Wendy Peterson ,
That's great. But please also check out my other reply in case you haven't seen it. There's no need for having two scripts.
Regards,
Robert
