How to escape special characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 06:48 AM
Hi All,
I am sending the json to 3rd party system. So using the BR i was forming it this way -
var r = new sn_ws.RESTMessageV2('Creation', 'Default PUT');
r.setStringParameterNoEscape('adhocID', current.number);
r.setStringParameterNoEscape('fieldid', current.field_id);
r.setStringParameterNoEscape('state', stateVal);
r.setStringParameterNoEscape('worknote', current.work_notes));
r.setStringParameterNoEscape('group', current.assignment_group.getDisplayValue());
r.setStringParameterNoEscape('closed', current.closed_at);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
I get an error message as the "Record was misformed" when the worknote is typed as-
ASU, Test
testasu
CN=tyty\, fgt,OU=CGS Users,DC=tester,DC=cvs
Wednesday, December 27, 2017 12:19:12 PM
How can i escape the speacial characters or any issue with this and get it working?
Thanks
Surya
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 10:33 AM
Still same issue. When i did a addinfomessage it showed a lot of \\\\\\\\\\\\\\\\\\\\\.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 08:30 AM
Can you guide me as to what i can try ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 10:36 AM
try changing below
notes +=(gr.sys_created_on + ' - ' + gr.sys_created_by + ' ' + gr.element + '- ' + gr.value + '\n');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 10:40 AM
Hi
I figured out that new lines is also causing the issue. I added to replace newlines. But then in the 3rd party system, it goes without any linebreaks and all get added as 1 line. Can I send them as new lines?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2018 10:45 AM
can you log json and see what exactly is being sent. do like gs.log(json.encode(notes));