Add a message under a field

Raji15
Tera Contributor

Hi, 

I have a variable named proxy and it has 4 options None, Yes, No, Not applicable. Whenever the user selecting Yes under the field I want a message "Archer request required" should populate. How to do that can anyone pls help. Thank you!

1 ACCEPTED SOLUTION

 

Hi @Raji15,

Containers are used to display variables either as a single field in a row or two fields in a row.

 

I Tried in my PDI , It is Working Fine

The issue is not related to the containers. Please review the backend values of the variables and choices, and try again.

Thanks and regards,
Badrinarayan"

View solution in original post

10 REPLIES 10

Gangadhar Ravi
Giga Sage
Giga Sage

@Raji15 @You can implement this with field message please refer below post.

 

https://www.servicenow.com/community/itsm-forum/how-to-add-field-message-to-selectbox/m-p/579097#M15...

 

Please mark my answer correct and helpful if this works for you.

Sandeep Rajput
Tera Patron
Tera Patron

@Raji15 You need to create an onChange client script on Proxy variable as follows.

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }

    // Check if the new value is 'Yes'
    if (newValue === 'Yes') {
        // Show a field message under the variable
        g_form.showFieldMsg('proxy', 'Archer request required', 'info');
    } else {
        // Clear the message if the value is not 'Yes'
        g_form.hideFieldMsg('proxy');
    }
}

Please mark my response helpful and accepted solution if it addresses your question.

Not working. The variable is inside the container. Is that cause any problem may be?

@Raji15 Shouldn't be an issue even if the variable is inside a container. Could you please share the variable name and the script you are tryring.