Multiline worknotes using REST API

Community Alums
Not applicable

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

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