Line break in g_form.showFieldMsg?

Sriraj V
Tera Contributor

Hi All,

I need to display a info message under a field. I have used g_form.showFieldMsg for that.

The thing is i need to display messages in next lines. I have searched in community and came to know that line break (\n) is not supported in fieldmsg, few threads suggested to write a for loop to display message in separate blocks. I did that and its working fine.

But customer felt that user experience will not be good if we displays messages in separate blocks.

Do we have any other alternate approach to display messages by adding a line break..?? I tried sys_ui_message.

I have created a record with line break there and called the same record in client script by using getMessage. If i alert the result it is coming in line break. But if i use the same in fieldmsg line break is not there.

Regards,

Sriraj

1 ACCEPTED SOLUTION

Sagar Pagar
Tera Patron

Hi @Sriraj Yathra,

The g_form.showFieldMessage() do not supports line break (\n). Instead of that you can add 2nd or 3rd field message for same field. It will show message in new line/block.

 

OR

You can take a look at the old thread -  Line breaks in showFieldMsg()?

 

Thanks,

Sagar Pagar

 

 

The world works with ServiceNow

View solution in original post

5 REPLIES 5

Sagar Pagar
Tera Patron

Hi @Sriraj Yathra,

The g_form.showFieldMessage() do not supports line break (\n). Instead of that you can add 2nd or 3rd field message for same field. It will show message in new line/block.

 

OR

You can take a look at the old thread -  Line breaks in showFieldMsg()?

 

Thanks,

Sagar Pagar

 

 

The world works with ServiceNow

It worked when you add 2nd or 3rd lines instead of using '\n' in showFieldMsg()?

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

that's correct. it's not supported

There is 1 approach but it uses DOM manipulation which is not recommended by ServiceNow.

So you can inform your customer about this issue and possibly cannot be done

Regards
Ankur

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

Sriraj V
Tera Contributor

Thank you Sagar & Ankur for the response.