change help text dynamically based on a value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2018 11:44 PM
HI All,
Is there any way /script that I can change the help text of a catalog item field based on the selection made on a select box?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 12:03 AM
Modifying the help text requires DOM Manipulation and I wouldn't recommend doing that... Well no one would.
https://docs.servicenow.com/bundle/helsinki-application-development/page/script/client-scripts/reference/r_AvoidDOMManipulation.html
This is a bit old but might help you if you really want to go forward with this.
https://community.servicenow.com/community?id=community_question&sys_id=e7ffcba5dbdcdbc01dcaf3231f9619a6
I'd recommend checking your requirement and seeing if you could just go ahead with a simpler solution like a script message.
If there's a lot of different help texts required, then you could consider including a word file to the item which would be a type of "how to use" guide if needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 12:56 AM
Hi,
Check below thread, this will help you.
how to show the help text for choice value in service catalog variable
Mark Correct/Helpful, if this helps you.
Regards,
Devyani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 08:50 AM
Hi,
If mention thread resolves your issue, so mark my answer correct and close the thread. So others will follow the same solution.
Regards,
Devyani

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 02:45 PM
Use g_form_getField("<fieldname>").placeholder to change the example text dynamically in a portal.
Use g_form.getControl("<fieldname>").placeholder to change the example text dynamically in the Now platform.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Works in portal
var portal = g_form.getField("enter_another_value");
portal.placeholder = "Please provide additional info about " + newValue;
//Works in Now platform
var platform = g_form.getControl("enter_another_value");
platform.placeholder = "Please provide additional info about " + newValue;
}