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 08:21 AM
try below
var r = new sn_ws.RESTMessageV2('Creation', 'Default PUT');
r.setStringParameter('adhocID', current.number);
r.setStringParameter('fieldid', current.field_id);
r.setStringParameter('state', stateVal);
r.setStringParameter('worknote', current.work_notes);
r.setStringParameter('group', current.assignment_group.getDisplayValue());
r.setStringParameter('closed', current.closed_at);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 08:25 AM
What has changed in this script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 08:28 AM
setStringParameterNoEscape to setStringParameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 09:02 AM
Hi Mike
Do we have some way where we can escape all special characters or anything that misforms the json ?
I see that when " is used it again shows 400. For some other characters it might still show issue. Is there a way we can handle this?