- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2020 07:27 AM
Hi All,
i am creating a catalog item in that I have a select box as Impact with choices as Level 1, Level 2, and Level 3
if level 1 is selected i need a text to be displayed similarly for level 2 and level 3 but the texts are different.
how do I do that? kindly help me
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2020 11:31 PM
Hi,
you should be using the variable name which is impact and values as L-1 etc
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
g_form.hideFieldMsg('impact');
if(newValue == 'L-1'){
g_form.showFieldMsg('impact', 'TESTING Message 1' ,'error', true);
if(newValue == 'L-2'){
g_form.showFieldMsg('impact','TESTING Message 2','error', true);
}
if(newValue == 'L-3'){
g_form.showFieldMsg('impact','TESTING Message 3','error', true);
}
}
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
‎11-20-2020 07:47 AM
Hi appu,
you can create a catalog client script with type onChange for that variable and use g_form.addInfoMessage for each of the choices of the variable.
Hope that helps.
Kind regards,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2020 08:10 AM
If you are wanting a message to appear under the field, use something similar to this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2020 08:15 AM
sample catalog client script
Ensure you select
UI Type - ALL
Applies to catalog Item - True
Use proper variable name
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
g_form.hideFieldMsg('your_variable'); // give here your variable name
if(newValue == 'Level 1'){
g_form.showFieldMsg('your_variable', 'Level 1 Message' ,'error', true); // give here your variable name
}
if(newValue == 'Level 2'){
g_form.showFieldMsg('your_variable','Level 2 Message','error', true); // give here your variable name
}
if(newValue == 'Level 3'){
g_form.showFieldMsg('your_variable','Level 3 Message','error', true); // give here your variable name
}
}
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
‎11-22-2020 04:54 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader