and more in a single search tool across platforms. Read the announcement here. |
03/22/2023 06:59 AM
Hi,
While creating accounts with a REST connector (for servicenow), we need to make multiple calls to fetch sys_ids for certain attributes, before the call to create account. Sample JSON looks like this -
"accountIdPath": "call4.message.result.sys_id",
"responseColsToPropsMap": {},
"call": [{
"name": "call1",
"connection": "acctAuth",
"url": "https://abc.service-now.com/api/now/table/cmn_department?sysparm_query=name=${user.costcenter}&sysparm_fields=sys_id",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
].................................
.............................
The part is bold is the user's cost-center and this call works if the cost-center does not have a space in it. But it fails if there is a space in the name of the cost-center.
How can I escape name=${user.costcenter} portion of the JSON, to handle cases where cost center can contains spaces?
Thanks
03/22/2023 09:17 AM
Can you try using ${encodeURIComponent(user.costcenter)} in the url.
This should encode the special characters in the url for the attribute costcenter.
03/22/2023 10:28 AM
Can you use the below code?
url": "http://xxxxxxxxx?${URLEncoder.encode(user.costcenter, \"UTF-8\").replace(\"+\", \"%20\")}"
This should parse all the special characters including space.