Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to change dynamically the help text of a variable on a portal form?

Smith Johnson
Kilo Sage

Hello,

 

is there any way to change dynamically the help text of a variable on a catalog item on portal???

For example, based on the "Activity" field, I would like to change dynamically the help text on the "Additional Information" field.

find_real_file.png

Thank you for your assistance,

Smith.

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi,

 

Unfortunately that is not possible. All you can do is use showFieldMsg() instead in a Client script.

View solution in original post

14 REPLIES 14

hi @Community Alums  not working in sc_task please help

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

 

@Community Alums That was amazing.  Thank you!

Where is the g_form.getField() method documented, please?

 

Community Alums
Not applicable

@G24 Good question.  I can't find documentation on it.  I have been using it a while but now I am weary about using it.  😬

I could not get .getControl() to work in the portal.

@Community Alums hi the code works only on portal not sc_task please help

var f = g_form.getValue('FIELD_NAME');
if (f) {
  f.help_text = 'OVERWRITE_MSG';
}