- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2020 10:44 PM
Hello,
I want to show help text based value selected in a previous variable.
Variable1 -> Yes/No
Variable2.
If Variable1 is set as YES then the help text of Varible2 should be "Test 1".
If Variable1 is set as NO then the help text Variable2 should be "Test 2".
I have created a UI policy and in script I use g_form.showFieldMsg.
But whenever I change the value in Variable1 the both the help text are displaying one down the another. Help text is not getting cleared based on the value selected.
Best Regards,
Ram
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2020 10:47 PM
Hi,
you cannot set dynamic help text directly
if you are using showFieldMsg then just when your onchange client script starts you need to hide the field message using hideFieldMsg
you should use client script when scripting is involved
please share your script
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
‎10-07-2020 11:16 PM
Hello,
Try below script in onChange catalog client script, It will gives you result as expected. change your variable names and messages as per need.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.hideFieldMsg('variable2','true');
return;
}
if(newValue == 'yes'){
g_form.hideFieldMsg('variable2','true');
g_form.showFieldMsg('variable2','Test 1','info');
}
if(newValue == 'no'){
g_form.hideFieldMsg('variable2','true');
g_form.showFieldMsg('variable2','Test 2','info');
}
}
Thanks,
Sagar Pagar