Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

If else condition in Rest CreateAccount JSON

RizvanaShaik
New Contributor
New Contributor

Hi Team,

while creating an account for application we are using Createaccount JSON as follows where we want the sid attribute to be populated if and only if the account name starts with 'S'

however , it is not working please specify if am missing anything syntax wise 

below is the create account JSON 

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": false,
"url": "<URL here>/v2/users",
"httpMethod": "POST",
"httpParams": "{ \"eid\": \"${user.username}\", \"sid\": \"${arsTasks.accountName like 's%'?arsTasks.accountName:'null'||''}}\", \"name\":\"${user.firstname+' '+user.lastname}\",\"firstName\": \"${user.firstname}\", \"lastName\":\"${user.lastname}\", \"email\": \"${user.email}\",\"active\": \"true\",\"role\":\"View Only\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
201,
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404
]
}
}
]
}

 

Thanks,

Rizvana

1 REPLY 1

rushikeshvartak
All-Star
All-Star

{
"accountIdPath": "accountName",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"showResponse": false,
"url": "<URL here>/v2/users",
"httpMethod": "POST",
"httpParams": "{ \"eid\": \"${user.username}\", \"sid\": \"${arsTasks.accountName?starts_with('S')?arsTasks.accountName:''}\", \"name\":\"${user.firstname + ' ' + user.lastname}\",\"firstName\": \"${user.firstname}\", \"lastName\":\"${user.lastname}\", \"email\": \"${user.email}\",\"active\": \"true\",\"role\":\"View Only\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
201,
200
]
},
"unsuccessResponses": {
"statusCode": [
400,
401,
403,
404
]
}
}
]
}


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