- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2022 01:47 AM
Hi All,
We have multi choice variable called (service ) in that we have multiple choices. if the choice contains 'SP', we need to set a other variable single line text value as ''123'', if the choice contains 'ORACLE,' we need to set a other variable single line text value as ''456'',.
Please suggest,
Thanks All.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2022 04:01 AM
Hi,
update as this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var service = g_form.getValue("vic_ServiceTier");
if(service.indexOf('SQL') > -1){
g_form.setValue("vic_PortNumber", "1433");
}
else if(service.indexOf("Oracle") > -1){
g_form.setValue("vic_PortNumber", "1521");
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2022 03:08 AM
Hi Ankur,
Thanks for reply,
Below script i have tried. below script it has mentioned equal but it should contains,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var service = g_form.getValue("vic_ServiceTier");
if(service == 'SQL'){
g_form.setValue("vic_PortNumber", "1433");
}
if(sevice == "Oracle"){
g_form.setValue("vic_PortNumber", "1521");
}
}
Please suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2022 04:01 AM
Hi,
update as this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var service = g_form.getValue("vic_ServiceTier");
if(service.indexOf('SQL') > -1){
g_form.setValue("vic_PortNumber", "1433");
}
else if(service.indexOf("Oracle") > -1){
g_form.setValue("vic_PortNumber", "1521");
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 07:59 PM
@varma
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader