08/10/2023 07:23 AM
Hi Team,
i am using the below Create Account JSON to create account in ServiceNow.
Account is getting created successfully, But when i trying to create one more account to same user working as expected in saviynt (accountname-testnew) but not in ServiceNow (accountname-${task?.accountName})
{
"accountIdPath":"call1.message.result.sys_id",
"responseColsToPropsMap":{
},
"call":[
{
"name":"call1",
"connection":"ServiceNow",
"url":"https://XXXXXXX.service-now.com/api/now/table/sys_user",
"httpMethod":"POST",
"httpParams":"{\"email\":\"${user.email}\",\"first_name\":\"${user.firstname}\",\"last_name\":\"${user.lastname}\",\"phone\":\"${user.phonenumber}\",\"employee_number\":\"${user.employeeid}\",\"user_name\":\"${task?.accountName}\",\"department\": \"${user.departmentname}\",\"title\": \"${user.title}\",\"location\": \"${user.location}\",\"manager\": \"${user.owner}\",\"city\":\"${user.city}\",\"country\":\"${user.country}\",\"source\":\"Saviynt\"}",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/json",
"unsuccessResponses":{
"error.message":"Operation Failed"
}
}
]
}
Any Inputs would be appreciated.
Solved! Go to Solution.
08/10/2023 08:31 AM
Hi @SumathiSomala ,
How are you triggering the new account task? Is it through a request?
If this is a rest provisioning json, can you try using ${arsTasks.accountName}
Developers Handbook (saviyntcloud.com)
08/10/2023 09:22 AM
Thanks you @armaanzahir
How are you triggering the new account task? Is it through a request?
Yes.
Tried ${arsTasks.accountName}
Working fine
08/10/2023 08:24 PM
Try below json
{
"accountIdPath":"call1.message.result.sys_id",
"responseColsToPropsMap":{
},
"call":[
{
"name":"call1",
"connection":"userAuth",
"url":"https://dev.service-now.com/api/now/table/sys_user",
"httpMethod":"POST",
"httpParams":"{\"city\":\"${user.city}\",\"country\":\"${user.country}\",\"email\":\"${user.email}\",\"first_name\":\"${user.firstname}\",\"last_name\":\"${user.lastname}\",\"phone\":\"${user.phonenumber}\",\"employee_number\":\"${user.employeeid}\",\"user_name\":\"${user.username}\",\"u_fullname\":\"${user.displayname}\",\"u_employement_type\":\"${user.employeeclass}\",\"u_discovery_source\":\"Saviynt\"}",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/json",
"unsuccessResponses":{
"error.message":"Operation Failed"
}
}
]
}
08/10/2023 10:22 PM
Thanks @rushikeshvartak
Already i tried
\"user_name\":\"${user.username}\"
When i trying to create one more account for same user it is not working.
{"auditDetails":{"call1":[{"headers":null,"message":{"error":{"message":"Operation Failed","detail":"Error during insert of sys_user (${user.firstname} ${user.lastname})"},"status":"failure"},"statusCode":403,"description":null,"status":"Failed"},
08/10/2023 10:26 PM
Share your json
08/10/2023 10:29 PM
Tried ${arsTasks.accountName} instead of ${task?.accountName} working fine
{
"accountIdPath":"call1.message.result.sys_id",
"responseColsToPropsMap":{
},
"call":[
{
"name":"call1",
"connection":"ServiceNow",
"url":"https://XXXXXXX.service-now.com/api/now/table/sys_user",
"httpMethod":"POST",
"httpParams":"{\"email\":\"${user.email}\",\"first_name\":\"${user.firstname}\",\"last_name\":\"${user.lastname}\",\"phone\":\"${user.phonenumber}\",\"employee_number\":\"${user.employeeid}\",\"user_name\":\"${task?.accountName}\",\"department\": \"${user.departmentname}\",\"title\": \"${user.title}\",\"location\": \"${user.location}\",\"manager\": \"${user.owner}\",\"city\":\"${user.city}\",\"country\":\"${user.country}\",\"source\":\"Saviynt\"}",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/json",
"unsuccessResponses":{
"error.message":"Operation Failed"
}
}
]
}
08/10/2023 10:30 PM
${accountName}
08/10/2023 10:40 PM
@rushikeshvartak both ${arsTasks.accountName}and${accountName} working as expected.
Can you suggest one from above?
08/10/2023 10:43 PM
what is issue then now ?
08/10/2023 11:24 PM
In that case, you can mark the replies working as answers so that no one mistakes this issue to be open.
Both the variables would work in your case.