
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2022 07:50 PM
I've recently built a flow using Flow Designer to post incident details to an MS Teams Channel using the OOB MS Teams Spoke. Business requirement was to post details whenever a new journal entry (Actions Taken) is posted on major incidents assigned to a specific group. The problem is, many users post comments to Actions Taken with one or more line breaks, but when the message is posted to the Channel, it appears as a single line of text without line breaks. I've used getJournalEntry(1) to post the last comment, and I've also tried using the below script, which appears as desired in background script, but for some reason the MS Teams Spoke seems to always ignore line breaks.
For Example:
Actions Taken Journal Entry:
- First I did this
- Then I did that
- And it was fixed
Appears as: 1. First I did this 2. Then I did that 3. And it was fixed
var journalObject = new GlideRecord('sys_journal_field');
journalObject.addQuery('element_id', fd_data.trigger.current.sys_id); //sys_id of the current incident record
journalObject.addQuery('element', 'actions_taken');
journalObject.orderByDesc('sys_created_on');
journalObject.query();
if (journalObject.next()) {
return journalObject.value; //Last journal entry for actions taken
}
Anyone else dealt with this for journal fields and found a way around it?
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2022 10:17 PM
Hi
while ServiceNow stores the work notes & and comments OOTB as plain text internally, I assume you can post to MS Teams HTML coded text.
So you could try to replace all \n chars (indicates a line break in plain text) with a <br/> tag 2(line break in HTML)
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2022 10:17 PM
Hi
while ServiceNow stores the work notes & and comments OOTB as plain text internally, I assume you can post to MS Teams HTML coded text.
So you could try to replace all \n chars (indicates a line break in plain text) with a <br/> tag 2(line break in HTML)
Kind regards
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 09:07 AM
That worked! Thank you