ServiceNow Create multiple accounts

SumathiSomala
Regular Contributor III
Regular Contributor III

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.

If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.
Regards,
Sumathi Somala
10 REPLIES 10

armaanzahir
Valued Contributor
Valued Contributor

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}

 

armaanzahir_0-1691681448330.png

Developers Handbook (saviyntcloud.com)

Regards,
Md Armaan Zahir

SumathiSomala
Regular Contributor III
Regular Contributor III

Thanks you @armaanzahir 

How are you triggering the new account task? Is it through a request?

Yes.

Tried ${arsTasks.accountName} 

Working fine

 

If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.
Regards,
Sumathi Somala

rushikeshvartak
All-Star
All-Star

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"
         }
      }
   ]
}

Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

SumathiSomala
Regular Contributor III
Regular Contributor III

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"},

If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.
Regards,
Sumathi Somala

Share your json


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

SumathiSomala
Regular Contributor III
Regular Contributor III

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"
}
}
]
}

If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.
Regards,
Sumathi Somala

${accountName}


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

@rushikeshvartak  both  ${arsTasks.accountName}and${accountName} working as expected.

Can you suggest one from above?

If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.
Regards,
Sumathi Somala

what is issue then now ?


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

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.

 

Regards,
Md Armaan Zahir