- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2019 06:30 PM
HI All
I have written the catalog client script foe showing the field message on the Choice List field, When choice value is selecting field message displaying properly but
when 'none' option is selecting its should clear the existing value.
Note : This issue only on the Service Portal only,
I tried below codes but no use
UI type Selected : All
g_form.hideFieldMsg('type1', clearAll = true);
g_form.hideFieldMsg('type1','Change functionality ','info',true);
g_form.hideFieldMsg('type1',true);
===============================================
The actual code below :-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var type = g_form.getValue('type1');
g_form.hideFieldMsg('type1',true);
if(type == 'new_enhancement')
{
g_form.showFieldMsg('type1','Changein functionality ','info',true);
}
if(type == 'critial_breakfix')
{
g_form.showFieldMsg('type1','Production error','info',true);
}
if(type == 'Maintenance')
{
g_form.showFieldMsg('type1','Routine change, update salary ranges)','info',true);
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2019 06:52 PM
I beleive what is happening is that the new value of type1 is None meaning ''. So try to write your code for hiding field message in that first if block.
if (isLoading || newValue == '') {
g_form.hideFieldMsg('type1',true);
return;
}
Please mark this answer as correct/helpful if this solves your problem

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2019 06:52 PM
I beleive what is happening is that the new value of type1 is None meaning ''. So try to write your code for hiding field message in that first if block.
if (isLoading || newValue == '') {
g_form.hideFieldMsg('type1',true);
return;
}
Please mark this answer as correct/helpful if this solves your problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2019 08:44 PM
Hi Ramesh,
Update the code as below
if (isLoading || newValue == '') {
if(newValue == ''){
g_form.hideFieldMsg('type1',true);
}
return;
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader