Catalog item variable help text.

abhisek
Tera Contributor

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.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@abhisek  

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@abhisek  

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

_Gaurav
Kilo Sage

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.