- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 05:03 AM
Hi All,
I have a requirement in Change Request form, in the category field below are the choices, when we select the below choices , another varible called CMDB checkbox, automatically it needs to checked , how to acheive this
Decommission - Application
Decommission - Application & Server
Decommission - In Build or Non operational CI
Decommission Server
System / OS upgrade
Tech Refresh / Server Migration
Project go-live
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 05:49 AM
Hi @MK21, you can also try the onChange client script on category field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 'Decommission - Application' || newValue == 'Decommission - In Build or Non operational CI' || newValue == 'Decommission Server' || newValue == 'System / OS upgrade' || newValue == 'Tech Refresh / Server Migration' || newValue == 'Project go-live') {
g_form.setValue('cmdb', true);
} else {
g_form.setValue('cmdb', false);
}
}
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 05:34 AM
Hi @MK21
Try like this:
g_form.setValue('fieldname', 'True');
or
function onCondition() {
g_form.setValue('category', Server);
}
In these
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 05:54 AM
Hello Atul,
for this category below are the choices
Decommission - Application
Decommission - Application & Server
Decommission - In Build or Non operational CI
Decommission Server
System / OS upgrade
Tech Refresh / Server Migration
Project go-live
when we select above choices below variable needs to auto check automatically
Please help on this when change is Normal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 05:57 AM
In UI policy add condition
type = Normal &
category is one of as above
Then go to script section
and bring another field as visible and
set value as per last comment.
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 05:49 AM
Hi @MK21, you can also try the onChange client script on category field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 'Decommission - Application' || newValue == 'Decommission - In Build or Non operational CI' || newValue == 'Decommission Server' || newValue == 'System / OS upgrade' || newValue == 'Tech Refresh / Server Migration' || newValue == 'Project go-live') {
g_form.setValue('cmdb', true);
} else {
g_form.setValue('cmdb', false);
}
}
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 06:07 AM
As per above, I'd recommend a UI policy for a no code solution as per the above replies.
If you wanted to client script it, it would look something like this...
//on change
var type = g_form.getValue('type'); // Field name with the choices stored.
var cmdb = g_form.getValue('cmdb');
if (type == 'choice_1' || type == 'choice_2' || type == 'choice_3') { //Your choices
g_form.setValue('cmdb', true).
} else{
g_form.setValue('cmdb', false);
}
}
Please mark as helpful or if its resolved your issue, mark as correct!