and more in a single search tool across platforms. Read the announcement here. |
on 09/06/2023 08:13 PM
Use-Case:
Many applications like Service Now require JSON's to handle escape characters. If the escape characters are not handled properly, the SNOW ticket creation process can fail. This can be achieved by using the escapeJava method of the StringEscapeUtils() constructor.
More Details:
1. public class StringEscapeUtils extends Object - Escapes and unescapes Strings for Java, Java Script, HTML, XML, and SQL.
2. escapeJava method details:
Example:
input string: He didn't say, "Stop!"
output string: He didn't say, \"Stop!\"
JSON Syntax in Saviynt:
{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "https://api.company.com/api/itsm/v1/request/create",
"httpMethod": "POST",
"httpParams": "{\"u_emplid\":\"${user.username}\", \"u_vendor_name\":\"Sayvint\", \"u_assignment_group\":\"MSP L2 Essbase\", \"u_short_descr\":\"Snow Access - ${user.username}\", \"u_description\":\"${org.apache.commons.lang.StringEscapeUtils.escapeJava(reqAttrs.customproperty10)}\", \"u_vendor_case_number\":\"7\", \"u_config_item\":\"Essbase\", \"u_priority\":\"3-Medium\", \"u_comments\":\"abcd\", \"u_work_notes\":\"Saviynt\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"ticketidPath": "ticketNumber",
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}]
}
Further Reading: