- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 04:46 AM
I have these variables on my catalog item:
application_service is on cmdb_ci_service table.
support_group is on sys_user_group table
When application_service changes I want support_group to change automatically.
This is my catalog client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var supportGroup = '';
var cmdbCiService = new GlideRecord('cmdb_ci_service');
cmdbCiService.addQuery('sys_id', newValue);
cmdbCiService.query();
g_form.addInfoMessage("OUSIDE: "+newValue);
if (cmdbCiService.next()) {
supportGroup = cmdbCiService.getValue('support_group');
g_form.addInfoMessage("Support: " + supportGroup);
}
g_form.setValue("variables.support_group", supportGroup);
}
I am able to fetch the sys_id correctly but not able to set the value. How can I do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 05:00 AM
@vidhya_mouli This can be done without scripting. Open the "Support group" variable and go to "Auto populate" section.
In dependent question, select Application service and "Sys ID" in dot walk path field.
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 05:11 AM
Hi @vidhya_mouli ,
You don't need any scripting for this. Use the Auto populate option which is on your support group variable.
Select the dependent question as Application service and on Dot walk path select the Support group.
Refer below screen.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 06:12 AM
I missed out this question , but proud you accepted the right answer and OOTB.
Thanks @Pavankumar_1
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************