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

\"username\":\"${if(task.requestKey!=null){${user.username}}}\" inactive or not found

yatishtiwari
Regular Contributor
Regular Contributor

Hi Team, 

It's a very trivial issue, but somehow I am not able to find out what the issue is.

We have a requirement to create/update a Sav4Sav account only when the source is a request  The JSON is working fine if I don't put a condition there, but when I put a condition, it's not able to resolve.

Working JSON

{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://dev.saviyntcloud.com/ECM/api/v5/createAccount",
"httpMethod": "POST",
"httpParams": "{\"securitysystem\":\"Sav4Sav_Dev\",\"endpoint\":\"Sav4Sav_Dev\",\"name\":\"${user.username}\",\"username\":\"${user.username}}\",\"requestor\":\"000229\",\"accountowner\":[{\"type\":\"user\",\"value\":\"${user.username}\",\"rank\":\"1\"}],\"displayname\":\"${user.displayname}\",\"comments\":\"CreatedForInternalUse\",\"accountid\":\"${user.username}\",\"customproperty1\":\"${user.customproperty1}\",\"customproperty30\":\"${user.customproperty30}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
}
}
]
}

Not Working JSON

{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://dev.saviyntcloud.com/ECM/api/v5/createAccount",
"httpMethod": "POST",
"httpParams": "{\"securitysystem\":\"Sav4Sav_Dev\",\"endpoint\":\"Sav4Sav_Dev\",\"name\":\"${user.username}\",\"username\":\"${if(task.requestKey!=null){${user.username}}else{''}}\",\"requestor\":\"000229\",\"accountowner\":[{\"type\":\"user\",\"value\":\"${user.username}\",\"rank\":\"1\"}],\"displayname\":\"${user.displayname}\",\"comments\":\"CreatedForInternalUse\",\"accountid\":\"${user.username}\",\"customproperty1\":\"${user.customproperty1}\",\"customproperty30\":\"${user.customproperty30}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
}
}
]
}

I tried multiple versions but not working for me.

${if(arsTasks.source.equals('REQUEST')){${user.username}}}

${if(task.requestKey!=null){${user.username}}}

${if(task.requestKey==null){${user.username}}}

${if(task.requestKey!=null){${user.username}}else{''}}

Exception 

{"auditDetails":{"call1":[{"headers":null,"message":{"errorCode":"1","message":"requestor ${if(arsTasks.source.equals('REQUEST')){${user.username}}} is inactive or not found"},"statusCode":412,"description":null,"status":"Failed"},{"headers":null,"message":{"errorCode":"1","message":"requestor ${if(arsTasks.source.equals('REQUEST')){${user.username}}} is inactive or not found"},"statusCode":412,"description":null,"status":"Failed"}

{"headers":null,"message":{"errorCode":"1","message":"requestor ${if(task.requestKey!=null){${user.username}}} is inactive or not found"},"statusCode":412,"description":null,"status":"Failed"},{"headers":null,"message":{"errorCode":"1","message":"User ${if(task.requestKey!=null){${user.username}}} inactive or not found"},"statusCode":412,"description":null,"status":"Failed"},{"headers":null,"message":{"errorCode":"1","message":"User ${if(task.requestKey!=null){${user.username}}else{''}} inactive or not found"},"statusCode":412,"description":null,"status":"Failed"}]},"call1":{"headers":null,"message":{"errorCode":"1","message":"User ${if(task.requestKey==null){${user.username}}else{''}} inactive or not found"},"statusCode":412,"description":null,"status":"Failed"}}

2 REPLIES 2

rushikeshvartak
All-Star
All-Star

,\"username\":\"${if(task?.requestKey!=null){user.username}else{}}\",


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

yatishtiwari
Regular Contributor
Regular Contributor

Thank you, @rushikeshvartak

After analysis, we found that in the Sav4Sav connection, the task object is not available; instead, the arsTasks object is available.  So the following syntax worked for us.

"{\"securitysystem\":\"${if(arsTasks.source.equals('REQUEST')){'Sav4Sav_Dev'}else{''}}\",

We can close this thread,

Thank you.