change help text dynamically based on a value

MMKK
Tera Expert

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?

5 REPLIES 5

Joni5
Tera Expert

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.

 

Devyani_6
Mega Guru

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

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

Community Alums
Not applicable

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;
}