Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

[REST Connector] CreateAccountJson - remove special character from the call1.message

npise
New Contributor III
New Contributor III

How do i remove special characters from below response that i get after create account. this responseMessage is mapped to accountIdPath 

"message":{"responseMessage":"\"233d71ef-e211-4e7e-958f-2a875c172f50\""}

i tried  "accountIdPath": "${call1.message.responseMessage.substring(1,-1)}", its not working 

Here the createAccountjson

{
"accountIdPath": "call1.message.responseMessage",
"responseColsToPropsMap": {
"displayName": "call1.message.fullname~#~char",
"name": "call1.message.email~#~char",
"customproperty1": "call1.message.email~#~char"
},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://api5.fastpathassure.com/api/core/users",
"httpMethod": "POST",
"httpParams": "{\"Email\": \"${user.email}\", \"FirstName\": \"${user.preferedFirstName}\",\"LastName\": \"${user.lastname}\", \"IdentityProviderId\": \"XXXXXX\", \"IdentityUserId\": \"${user.email}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"TenantId": "XXXXXX"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
500,
403,
409,
400
]
}
}
]
}

 

Account ID are stored with double quotes (see below)

npise_0-1684541277453.png

 

9 REPLIES 9

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @npise

You May try replacing the account id path and check if it works.

"call1.message.responseMessage.replaceAll('\"', '')"

or

"${call1.message.responseMessage.replace(/"/g, '')}"

For Ref:- 
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm 

 
Thanks,
If you find the above response useful, Kindly Mark it as "Accept As Solution".

rushikeshvartak
All-Star
All-Star

"accountIdPath": "call1.message.id.toString().replaceAll('\"','')",


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

npise
New Contributor III
New Contributor III

@rushikeshvartak @sudeshjaiswal thank for your response.

its not working. i tried the below:

 "accountIdPath": "call1.message.id.toString().replaceAll('\"','')" 

"accountIdPath": "call1.message.responseMessage.toString().replaceAll('\"','')"

please suggest!

Is there any error


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

No there is no error.

As per developers handbook will the below work?

"accountIdPath": "#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.replace('\"',''); return acctId}"

Use toString()


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

like this??

"accountIdPath": "#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.toString().replace('\"',''); return acctId}"

npise
New Contributor III
New Contributor III

this worked!! thank you!

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @npise

Please try this.
{
"accountIdPath":"#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.toString().replace('\"',''); return acctId}",
"responseColsToPropsMap":{
"displayName":"call1.message.fullname~#~char",
"name":"call1.message.email~#~char",
"customproperty1":"call1.message.email~#~char"
},
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://api5.fastpathassure.com/api/core/users",
"httpMethod":"POST",
"httpParams":"{\"Email\": \"${user.email}\", \"FirstName\": \"${user.preferedFirstName}\",\"LastName\": \"${user.lastname}\", \"IdentityProviderId\": \"XXXXXX\", \"IdentityUserId\": \"${user.email}\"}",
"httpHeaders":{
"Authorization":"${access_token}",
"TenantId":"XXXXXX"
},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
200
]
},
"unsuccessResponses":{
"statusCode":[
500,
403,
409,
400
]
}
}
]
}

Thanks

 
If you find the above response useful, Kindly Mark it as "Accept As Solution".