- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 11:28 PM
I want to display a field message and the message should be in the following format:
"The order placed is listed in your requests
Navigate to it"
But when i m using g_form.showFieldMsg() it is not helping me to go to new line.
How can I achieve this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 06:16 AM
showFieldMsg() in ServiceNow does not support multi-line messages or HTML formatting like <br> tags or \n. if you want it to display multi-line messages , you need to call g_form.showFieldMsg() multiple times. In the above case you need to call g_form.showFieldMsg() 2 times like
g_form.showFieldMsg ('field_name', 'The order placed is listed in your requests', 'info');
g_form.showFieldMsg ('field_name', 'Navigate to it', 'info');
another approach is to use addInfoMessage() which supports multi-line messages , as it will allow you to use <br> for line breaks .
g_form.addInfoMessage('The order placed is listed in your requests<br>Navigate to it');
If my response is useful . click here to mark the posts as helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 11:32 PM
Can you please describe what is your meaning by - "it is not helping me to go to new line."
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 06:16 AM
showFieldMsg() in ServiceNow does not support multi-line messages or HTML formatting like <br> tags or \n. if you want it to display multi-line messages , you need to call g_form.showFieldMsg() multiple times. In the above case you need to call g_form.showFieldMsg() 2 times like
g_form.showFieldMsg ('field_name', 'The order placed is listed in your requests', 'info');
g_form.showFieldMsg ('field_name', 'Navigate to it', 'info');
another approach is to use addInfoMessage() which supports multi-line messages , as it will allow you to use <br> for line breaks .
g_form.addInfoMessage('The order placed is listed in your requests<br>Navigate to it');
If my response is useful . click here to mark the posts as helpful.