We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Ticket Status JSON is not pulling correct status

kmashwini
New Contributor III
New Contributor III

Below is the JSON I am using for Ticket Status JSON , even though sc task is open it is closing the pending task and moving to complete task. Pending task should always close only status is "Closed Incomplete", "Closed Complete", "Closed Skipped" but it is not working as expected . Can any one help me what is the issue with below json.

{
"call": [
{ "name": "call1",
"connection": "userAuth",
"url":"https://url/api/now/table/sc_request?sysparm_query=request.number=${ticketID}&sysparm_limit=1&syspar...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}" },
"httpContentType": "application/json",
"ticketStatusPath": "result[0].state",
"ticketStatusValue": [ "Closed Incomplete","Closed Complete","Closed Skipped"],
"successResponses": {}
}
]
}

4 REPLIES 4

shivmano
Regular Contributor III
Regular Contributor III

Please verify that the connection name is same as what is specified in the connection JSON. Also, please try with the below JSON and check the behavior

{
 
"call": [
 
{
 
"name": "call1",
 
"connection": "userAuth",
 
"url": "https://<SNPATH>/api/now/table/sc_req_item?sysparm_query=request.number=${ticketID}&sysparm_limit=1&sysparm_display_value=true",
 
"httpMethod": "GET",
 
"httpHeaders": {
 
"Authorization": "${access_token}"
 
},
 
"httpContentType": "application/json",
 
"ticketStatusPath": "result[0].state",
 
"ticketStatusValue": [
 
"Closed Complete"
 
],
 
"disContinueStatusValue": [
 
"Closed Incomplete"
 
]
 
}
 
]
 
}

 

kmashwini
New Contributor III
New Contributor III

@shivmano  What do you mean by connection name in connection json, the below is my connection json 

{
"authentications": {
"userAuth": {
"authType": "oauth2",
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed"
],
"expiryError": "ExpiredAuthenticationToken",
"url": "https://url/oauth_token.do",
"httpMethod": "POST",
"contentType": "application/x-www-form-urlencoded",
"errorPath": "errors.type",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer abcd",
"httpParams": {
"grant_type": "password",
"client_id": "xxxx",
"client_secret":"xxx",
"username":"xxx",
"password":"xxxx"
},
"retryFailureStatusCode": [401, 403]
}
}
}

rohitkumarraj
Regular Contributor
Regular Contributor

Try this once:

"ticketStatusValue": [ "Closed Incomplete","Closed Complete","closed_complete","Closed Skipped","3"],

The idea here is: If the  "ticketStatusValue" doesn' work with string which you mentioned in the values, try using value code(for e.g. 3 stands for completed). Many a times ServiceNow returns code of closed/open/incomplete/etc status and you are trying catching the string values which might not work. Its setting which snow team does at their side to set the technical value of variable which will be returned.

You can trace what values get returned on different status of snow task through Logs, If not getting ask Snow team to provide. This will be sorted!!

 

 

@rohitkumarraj  I tried you as above said . But still pending task is pending in Saviynt even though ticket is closed in snow. 

{
"call": [
{ "name": "call1",
"connection": "userAuth",
"url":"https://edjdev.service-now.com/api/now/table/sc_request?sysparm_query=request.number=${ticketID}&sys...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}" },
"httpContentType": "application/json",
"ticketStatusPath": "result[0].state",
"ticketStatusValue": [ "Closed Incomplete","Closed Complete","closed_complete","Closed Skipped","3","4","7"],
"successResponses": {}
}
]
}