ServiceNow as Ticketing System - Multiple Call in CreateTicketJSON

adriencosson
Regular Contributor III
Regular Contributor III

Hi !

I am working on implementing a Service Desk connection with ServiceNow to open requests from Saviynt. In my use case, it consists in 2 API calls : 

  1. Create the request, which sends a success message with the REQ12345 id
  2. Make a second API call to get the RITM id and state based on the previous request number

I have a few concerns where I'd need your help : 

  1. When I perform the request, I am getting error in the logs : "Error in getting Ticket Number". My assumption is that it tries to get it from the first call instead of performing the second call that will retrieve the RITM state. >> Can we perform multiple call in CreateTicketJSON ?
  2. When I create the request with the associated variables, I am getting the RITM with the variables that are not computed - such as the "requested_for" (response attached). >> Can you help troubleshoot why it took the variables as plain text instead of computing them ?

PFA logs, CreateTicketJSON and response from second call are attached.

Regards,
Adrien COSSON
5 REPLIES 5

nimitdave
Saviynt Employee
Saviynt Employee

@adriencosson , yes we can do multiple call in createticketjson.

However, I see in your API response of first call , the RITM number which will be dynamic is itself coming as a key. But still try once as below to retrieve it in call2:

${response.createRequest.message.result[0].number}

Also please try call1 with a static value for expression ${com.saviynt.ecm.identitywarehouse.domain.Users.get(task?.requestedBy).customproperty26} . This to isolate the issue.

 

adriencosson
Regular Contributor III
Regular Contributor III

Hello @nimitdave ,

Thanks for the information,

Actually the response I gave is from second call (how I expect it to be).

For first call response I retrieve the REQ id using the ${response.createRequest.message.result.number} path which should be fine.

I did try the same without the ${com.saviynt.ecm.identitywarehouse.domain.Users.get(task?.requestedBy).customproperty26} (which I definitely can replace by ${requestedBy.customproperty26} but I am still getting the same error : 

{"accountComments":";Ticket Number=;"}

I also tried to empty the ticketidPath and ticketStatusPath from first API call and only have them in the second call (where it is expected) and it is failing.

Regards,
Adrien COSSON

Hi @adriencosson 
When there are multiple calls in CreateTicketJSON, the ticketidPath needs to be placed outside the call.
Please check the below sample and provide the valid traversing path to the TicketID.

{
  "ticketidPath": "call2.message.<Path to the TicketID>",
  "call": [
    {
      "name": "call1",
      "connection": "userAuth",
      "url": "<<>>",
      "httpMethod": "POST",
      "httpParams": "{<<>>}",
      "httpHeaders": {
        "Authorization": "${access_token}"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          200,
          201
        ]
      }
    },
    {
      "name": "call2",
      "connection": "userAuth",
      "url": "${response.call1.headers.Location}",
      "httpMethod": "GET",
      "httpParams": "{}",
      "httpHeaders": {
        "Authorization": "${access_token}"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          200,
          201
        ]
      }
    }
  ]
}

If you still face any issues please share the below :

1. Confirmation that the call2 is invoked and you have a valid response.
2. Response of call2

Thank you
Vedanth B.K

adriencosson
Regular Contributor III
Regular Contributor III

Hello @Vedanth_BK ,

Thanks for your help, we managed to make it with a single API Call that provides the Request Number and the task goes to "Pending Provision" state.

Now we want to achieve the following : 

One of the attributes must be the Requestor's customproperty26. Following the documentation, we tried the same but none of the below were successful : 

https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm#top

  • ${task.requestedBy.customproperty26}
  • ${requestor.customproperty26}
  • ${com.saviynt.ecm.identitywarehouse.domain.Users.get(task?.requestedBy).customproperty26}

Thanks for helping.

Regards,
Adrien COSSON

adriencosson
Regular Contributor III
Regular Contributor III

Hello @Vedanth_BK ,

For my latest reply, I was able to make it using the below variable :

  • ${requestor.customproperty26}

For using multiple API Calls, I have tried the attached JSON but it is not working.

Note that I also attached the JSON response where I would need to use a wildcard but it retrieves me a "null" value a RITM Number.

Can you help me finding the appropriate path ? Below are not working : 

  • getRITMNumber.message.result.*.number
  • getRITMNumber.completeResponseMap.result.*.number

Thanks !

Regards,
Adrien COSSON