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

ServiceNow connection for creating ticket

Ekata
New Contributor III
New Contributor III

Hi Team,

I have requirement for creating ticket in ServiceNow where we need to call 2 jsons under create ticket json one for getting the data and the other is to create it with 2 different APIs.

Below are the APIs provided by client with is working in postman:

1. GET--> https://domain.service-now.com/api/now/table/sys_user?sysparm_query=active%3Dtrue%5Euser_name%3D{{eC...

2. POST--> https://domain.service-now.com/api/sn_sc/servicecatalog/items/801dfde6db9bd700677d3437b996198e/order...

The body in POST method should contain the below parameters:

{
    "sysparm_quantity":"1",
    "variables":{
        "case_code":"06f9b8fa1b9360108c122066b04bcb30",
        "request_type":"Request a Desktop",
        "requested_for":"9d73bbf71bbf9590360da8e82d4bcb68",
        "physical_location":"EU2"
    }
}
 
I tried to create a json which is:
{
   "call":[
      {
         "name":"call1",
         "connection":"userAuth", 
         "url":"https://domain.service-now.com/api/now/table/sys_user?sysparm_query=active%3Dtrue%5Euser_name%3D${us...,
         "httpMethod":"GET",
         "httpHeaders":{
            "Authorization":"${access_token}"
         },
            "httpContentType": "application/json",
            "ticketidPath": "result[0].sys_id",
             "successResponses": {
        "statusCode": [
          200,
          201
        ]
             },
            "unsuccessResponses":{
            "error.message":"Operation Failed"}
      },
      {
         "name":"call2",
         "connection":"userAuth", 
         "url":"https://domain.service-now.com/api/sn_sc/servicecatalog/items/801dfde6db9bd700677d3437b996198e/order...,
         "httpMethod":"POST",
          "httpParams":"{\"sysparm_quantity\":\"1\",\"variables\":{\"case_code\":\"06f9b8fa1b9360108c122066b04bcb30\",\"request_type\":\"Request a Desktop\",\"requested_for\":\"${response.call1.message.result[0].sys_id}\",\"physical_location\":\"EU2\"}}",
         "httpContentType": "application/json",
         "httpHeaders":{
            "Authorization":"${access_token}"
         },

            "ticketidPath": "result[0].request_number",
            "ticketStatusValue": [
                "Closed",
                "Closed Complete",
                "Resolved"
            ],
            "disContinueStatusValue": [
                "Closed Incomplete",
                "Closed Skipped"
                ],
      "successResponses": {
        "statusCode": [
          200,
          201
        ]
      },
        "unsuccessResponses":{
            "message":"Operation Failed"}
}
]
}
 
However, the response we received in task is NULL. There is no error message found in logs as well. How can we use multiple APIs here.
Please suggest.
 
regards,
Ekata
Who Me Too'd this topic