ServiceNow: createticket JSON is not working

saurabhpad
New Contributor II
New Contributor II

Hi,

We are trying to create service now ticket to disable account. below is the JSON which we are using. 

 

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "test.com",
"httpMethod": "POST",
"httpParams": "{\"variables\" :{\"catalogid\":\"1f5888f287187d505a2f53973cbb35d8\",\"iehp_id\":\"$user.username\",\"departure_date_time\":\"$user.customproperty37\",\"employee_type\":\"$user.employeeType\",\"saviynt_task_id\":\"$task.taskid\",\"departure_type\":\"Immediate\"} }",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "result.message",
"successResponses": {
"statusCode": [
200
]
}
}
]
}

 

we are facing issue of request body. instead of sending values JSOn is send as is.

ex: user.username  send as it is instead of actual username

let us know if we are missing anything

1 REPLY 1

armaanzahir
Regular Contributor III
Regular Contributor III

Hi @saurabhpad 

You're not using curly braces in your variables.

Can you try the following:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "test.com",
"httpMethod": "POST",
"httpParams": "{\"variables\" :{\"catalogid\":\"1f5888f287187d505a2f53973cbb35d8\",\"iehp_id\":\"${user.username}\",\"departure_date_time\":\"${user.customproperty37}\",\"employee_type\":\"${user.employeeType}\",\"saviynt_task_id\":\"${task.taskid}\",\"departure_type\":\"Immediate\"} }",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "result.message",
"successResponses": {
"statusCode": [
200
]
}
}
]
}

Other than that, check if the variables are supported as per the documentation: Developers Handbook (saviyntcloud.com)

armaanzahir_0-1692876066555.png

 

Regards,
Md Armaan Zahir