- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 09:31 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 09:39 PM
Hi
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 09:39 PM
Hi
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2023 08:23 AM
It worked when you add 2nd or 3rd lines instead of using '\n' in showFieldMsg()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 09:41 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2022 09:43 PM
Thank you Sagar & Ankur for the response.