I need to change the help text font and color

Jeni2
Tera Contributor

Hi All,

 

i have written below code to populate the help text based on the value chosen but its coming as plaintext in the form with the blue background . I want to change the text color , background color and the font size. Could you please guide me in how to achieve this?

var radioField = g_form.getValue('user_type');
    if (radioField == 'bulk') {
        g_form.showFieldMsg('user_type', 'It seems you're requesting access for multiple users . Please note that this request should be used only for a minimum  5 and maximum 10 users ', 'info');
 
}
 
Thanks in advance.
4 REPLIES 4

Shaqeel
Mega Sage

Hi @Jeni2 

 

I found this article 

 

Regards

Shaqeel


***********************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

***********************************************************************************************************************





Regards

Shaqeel

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Jeni2 Play with this code

 

var fieldName = 'priority';
g_form.showFieldMsg(fieldName, 'Here is my message', 'error');
// Change the style
var msgEl = $(g_form.tableName + '.' + fieldName + '_' + 'fieldmsg').down();
msgEl.setStyle({
  backgroundColor: 'lightblue',
  borderColor: 'orange',
  color: 'purple',
});

 

Jeni2
Tera Contributor

Hi @Sid_Takali ,

below script is not working as expected

 var radioField = g_form.getValue('user_type');
    if (radioField == 'bulk') {
        g_form.showFieldMsg('user_type', 'It seems youre requesting access for multiple users . Please note that this request should be used only for a minimum  5 and maximum 10 users . To ensure a smooth fulfillment process, please follow these steps else your request will be rejected:', 'info');
        var msgEl = $(g_form.tableName + '.' + radioField + '_' + 'fieldmsg ').down();
        msgEl.setStyle({
            backgroundColor: 'lightblue',
            borderColor: 'orange',
            color: 'purple',
        });

swathisarang98
Giga Sage
Giga Sage

Hi @Jeni2 ,

 

For showFieldMsg you can show it as warning, error or info you cannot style it out of the box, instead you can use html field,

 

Please refer the below article,

https://www.servicenow.com/community/developer-forum/showfieldmsg-rather-than-use-oob-font-color-or-... 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang