Clear Field Message

Rakshanda Kunte
Tera Contributor

Hi All,

 

How can we remove the message that we created with "g_form.showFieldMsg"?

I need to perform same action which we perform with "g_form.clearMessages()".

 

 

Thanks.

1 ACCEPTED SOLUTION

@Rakshanda Kunte 

just want to inform that you need to use sysId for department since it's reference variable

var a = g_form.getValue('department');

if (a == 'it_demoSysId') {
g_form.showFieldMsg('type_1', 'Note: This is info message');
}
else if (a == 'cse_demoSysId')
{
g_form.hideFieldMsg('type_1');
}

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

View solution in original post

7 REPLIES 7

Harish Bainsla
Kilo Patron
Kilo Patron

if you want to hide field message use

g_form.hideFieldMsg(<field_name>);

Ankur Bawiskar
Tera Patron
Tera Patron

@Rakshanda Kunte 

you need to use g_form.hideFieldMsg

what script did you try and what's not working?

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

Hi @Ankur Bawiskar ,

 

Issue: once I select CSE in department, I do not want to see message "Note : This is info message".

 

RakshandaKunte_2-1698667535222.png

 

RakshandaKunte_1-1698667185205.png

 

Script:

 

var a = g_form.getValue('department');

    if (a == 'it_demo') {
        g_form.showFieldMsg('type_1', 'Note: This is info message');
    }
    else if (a == 'cse_demo')
    {
       g_form.showFieldMsg ('type_1', 'Note: This is warning message');
    }

 

@Rakshanda Kunte 

just want to inform that you need to use sysId for department since it's reference variable

var a = g_form.getValue('department');

if (a == 'it_demoSysId') {
g_form.showFieldMsg('type_1', 'Note: This is info message');
}
else if (a == 'cse_demoSysId')
{
g_form.hideFieldMsg('type_1');
}

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