04/24/2023 12:55 AM
Hi Expert,
I am facing an issue while integrating ServiceNow as a ticketing tool, when I process the task it shows pending provision and the ticket is getting created in servicenow, but the task is not processing to complete, if I manually close the ticket from ServiceNow side and again run the prov job still it is not changing the status, showing errorr. Here are the below details of the json and error message.
connection:
{
"authentications": {
"userAuth": {
"authType": "oauth2",
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"authError": ["InvalidAuthenticationToken"],
"url": "https://dev167564.service-now.com/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": "0e863086af5a2110c1fd6a2f581603f1",
"client_secret":"tCNmwrka*9",
"username":"admin",
"password":"dlA-A%hHS35m"
},
"retryFailureStatusCode": [401, 403]
}
}
}
===================
create ticket json
{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "https://dev167564.service-now.com/api/now/table/incident",
"httpMethod": "POST",
"httpParams": "{\"u_caller\":\"Naren Mon\",\"u_short_description\":\"need it somethingsdf\",\"u_state\":\"New\",\"u_urgency\":\"Medium\"}",
"httpParams": "{\"bp_id\":\"Naren Mon\",\"u_short_description\":\"need it somethingsdf\",\"u_state\":\"New\",\"u_urgency\":\"Medium\"}",
"httpHeaders": {
"Content-Type":"application/json",
"Accept":"application/json",
"Authorization":"${access_token}"
},
"httpContentType": "application/raw",
"ticketidPath":"result.number",
"ticketStatusPath":"result.state",
"ticketStatusValue": ["open","OPEN","Open"],
"successResponses": {
"200": "User Created Successfuly",
"201": "User Created Successfuly",
"204": "User Created Successfuly",
"205": "User Created Successfuly"
},
"unsuccessResponses": {
"400": "Create Account Failed",
"401": "Create Account Failed",
"404": "Create Account Failed",
"405": "Create Account Failed",
"500": "Create Account Failed",
"502": "Create Account Failed"
}
}]
}
=====================
TicketStatusJSON:
{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://dev167564.service-now.com/api/now/table/incident?sysparm_query=number{ticketID}&sysparm_limi...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type":"application/json",
},
"httpContentType": "application/raw",
"ticketStatusPath":"result[0].state",
"ticketStatusValue": ["closed","CLOSED","Closed"],
"disContinueStatusValue": [ "Closed Incomplete","closed incomplete" ,"CLOSED INCOMPLETE"],
"successResponses": [
{}
]
}
]
}
04/24/2023 12:59 AM
Here is the result of my create ticket :
04/24/2023 09:26 PM
{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://dev167564.service-now.com/api/now/table/incident?sysparm_query=number{ticketID}&sysparm_limi...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type":"application/json",
},
"httpContentType": "application/raw",
"ticketStatusPath":"result[0].state",
"ticketStatusValue": ["closed","CLOSED","Closed","1"],
"disContinueStatusValue": [ "Closed Incomplete","closed incomplete" ,"CLOSED INCOMPLETE"],
"successResponses": [
{}
]
}
]
}
04/24/2023 02:28 PM
Hi Manoj,
I don't see any ticket status in the API response. Can you please let me know what's the determining attribute in the result?
04/24/2023 10:36 PM
Please check below if this helps :
{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://<URL>/api/now/v1/table/incident?sysparm_query=number=${ticketID}&sysparm_limit=1&sysparm_display_value=true",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].close_code",
"ticketStatusValue": [
"Resolved by change",
"Resolved by caller",
"Resolved by problem",
"Resolved by request",
"Solution provided",
"Workaround Provided"
],
"disContinueStatusValue": [
"No resolution provided",
"Known error",
"Duplicate",
"User error"
],
"successResponses": [
{}
]
}
]
}
05/08/2023 03:44 AM
Hi Manish,
I am still getting the error, after passing "ticketStatusPath": "result[0].close_code",
Regards,
Manoj
05/08/2023 08:45 PM
Hi Manoj,
Few suggestions :
Via SNOW UI / Postman you can validate the REST API.
Put a sample ticket and fetch the details of the parameter via which you can determine the attribute for closure value.
05/08/2023 10:01 PM
Hi Manu,
I have change the field close_code to return the status fo the ticket and here it is.
ticketstatusjson:
{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://dev64807.service-now.com/api/now/table/incident?sysparm_query=number{ticketID}&sysparm_limit...",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath":"result.close_code",
"ticketStatusValue": [
"Workaround provided","6","7","1","Resolved","Completed","closed_complete","Closed Complete","Closed"
],
"successResponses": [
{"message": "done"}
]
}
]
}
createticketjson:
{
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "https://dev64807.service-now.com/api/now/table/incident",
"httpMethod": "POST",
"httpParams": "{\"assigned_to\":\"Andrew Och\", \"comments\":\"test creation from SSM -- $user.username $user.firstname\",\"short_description\":\"short description test\",\"description\":\"description test test creation from SSM\" }",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "result.number",
"ticketStatusPath": "result.close_code",
"ticketStatusValue": [
"Open", "OPEN", "open"
],
"successResponses": {
"200": "closed successfully",
"201": "closed successfully",
}
}]
}
05/11/2023 07:44 AM
Hi Team,
any help here would be appreciated
Regards,
Mano
06/27/2023 02:41 AM
Any update on this ... I am getting ticket status in Provisioning MetaData
07/12/2023 01:42 PM
No Dear, still i have the same issue
07/12/2023 09:49 PM
Share latest Ticket status json