Click HERE to see how Saviynt Intelligence is transforming the industry. |
07/29/2024 03:54 PM
Hi All,
Usecase :
1) Get account details of the user from endpoint 7.
2) Pass the comments field in the response to the second API call.
3) Second API call updates user profile with the comments value.
I am using the Sav4Sav Rest connector and below is my UpdateUserJson
{
"actions": {
"Disable User": {
"call": [
{
"name": "call1",
"callOrder": 0,
"connection": "userAuth",
"url": "https://XXX/ECM/api/v5/getAccounts",
"httpMethod": "POST",
"httpParams": "{\"username\":\"${user.username}\",\"accountQuery\":\"acc.endpointkey='7'\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
}
},
{
"name": "call2",
"callOrder": 1,
"connection": "userAuth",
"url": "https://XXX/ECM/api/v5/updateUser",
"httpMethod": "POST",
"httpContentType": "application/json",
"httpParams": "{\"username\":\"${user.username}\",\"customproperty44\":\"${response.call1.message.Accountdetails[0].comments}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}
}
}
Here is the response from the firstcall
{
"msg": "Successful",
"displaycount": 1,
"total": 1,
"Accountdetails": [
{
"creator": "System created",
"comments": "ServiceNow Request Number=REQ0021701",
"displayName": "000324794",
"endpointKey": 7,
"createdon": "07/27/2024",
"userKey": "23194",
"accountKey": 798568,
"accountID": "000324794",
"endpoint": "AD Snow Form",
"updatedate": "07/27/2024",
"accountowner": [],
"name": "000324794",
"status": "Manually Provisioned",
"username": "000324794"
}
],
"errorCode": "0"
}
Error : Task Response: {"Disable User":{"headers":null,"message":{"errorCode":"1","message":" Users not found with username ${users.username}"},"statusCode":412,"description":null,"status":"Failed"}}
The issue is with the response.call1.message.Accountdetails[0].comments beacuse the above JSON works with the customproperty44 is hardcoded. Can anyone please help here?
07/29/2024 08:53 PM
Hi @PratithShetty , instead of users.username use user.username
if this doesn't work, trigger the job, fetch the logs and share it across
08/06/2024 08:47 AM
@NM - Did, the same issue persists.
07/29/2024 09:50 PM