Multiline worknotes using REST API

Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 01:46 AM
Hi,
How to pass multiline worknotes without escaping newlines and special characters in REST API.
I am trying with below code.
var worknotes = current.work_notes.getJournalEntry(1).toString();
worknotes = worknotes.replace(/[^a-zA-Z0-9\r\n ]+/g, " ");
r.setStringParameter('work_notes',new global.JSON().encode(worknotes));
Currently worknotes coming as below when I tested in postman. I need to send line by line as it is in worknotes.
Sample Response:
(Work notes)\nType of Call: outbound\r\nPC #: 3221\r\n\r\nCustomer's Complete Name and Position: Terra \r\nAlternate Callback #: 9191231\r\n\r\nIssue Reported by the Customer: POS connection error\r\nIssue start date and time:\r\n\r\n
Thank you in advance.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2022 11:28 PM
Were you able to achieve this?
If yes then please share the approach so that it helps future members.
Regards
Ankur
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader