- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 02:32 AM
I have a catalog item text variable for example name. I have another catalog item variable for example select value which has 2 values for example important and not important.
The requirement is if select value is selected as important then help text of name variable should be for example 'please provide the important details' and if select value is selected as not important then help text should be for example 'please provide the not important details'
Can anyone please help me out with this.
Thanks in advance.
Regards,
Abhisek Chattaraj.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 02:51 AM
you cannot change help text dynamically using scripting.
You can show field message on that 2nd variable based on 1st variable value
Something like this, I hope you can enhance it further based on your developer skills and experience
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
g_form.hideFieldMsg('variable2');
if (newValue == "important ") {
g_form.showFieldMsg('variable2', 'please provide the important details', 'info');
} else if (newValue == 'not important ') {
g_form.showFieldMsg('variable2', 'please provide the not important details', 'info');
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 02:51 AM
you cannot change help text dynamically using scripting.
You can show field message on that 2nd variable based on 1st variable value
Something like this, I hope you can enhance it further based on your developer skills and experience
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
g_form.hideFieldMsg('variable2');
if (newValue == "important ") {
g_form.showFieldMsg('variable2', 'please provide the important details', 'info');
} else if (newValue == 'not important ') {
g_form.showFieldMsg('variable2', 'please provide the not important details', 'info');
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 02:53 AM
Hi @abhisek with the help text you can not achieve this functionality, rather use the on change client script on the selection of select value field and use the g_form.showFieldMsg('field_name','text'); to display the content beneath the name field.
Please mark this as helpful if this resolve you query.