Inconsistent Line Break Behavior in System UI Messages (sys_ui_message) – Clarification Needed
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
We have observed inconsistent behavior with line breaks in System UI Messages (sys_ui_message) in ServiceNow.
- In one scenario, line breaks are not displayed unless <br> tags are explicitly added in the message text.
- In another scenario, line breaks are rendered correctly even without using <br> tags.
Due to this inconsistent behavior, it is unclear what the recommended or correct approach is when defining UI messages.
Could anyone help clarify:
- What causes this difference in behavior?
- Is using <br> tags the recommended best practice for multiline messages in ServiceNow?
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Mohamed_009
refer this KB: KB1005865 Unable to translate if the 'sys_ui_message' if the key has '\n' it from VA Designer.
Can you try with this resolution:
Resolution
- The gs.getMessage call sends the text correctly.
- To get a new line to work in scriptable form, you need to add another escape character in the script.
For example :
- Suppose if the sys_ui_message has the key with 'hello \n world' the script portion to get a hit on this key needs to be 'gs.getMessage('hello \\n world');
- This will hit that desired 'sys_ui_message' and this is not designer behavior but the platform.
- The same behavior is expected when running in background scripts on the platform.
gs.getInfo(gs.getMessage('hello \\n world'))Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
share screenshots where are these messages rendered and how you configured those
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
