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

Service now provisioning issue

Manoj901
New Contributor
New Contributor

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": [
 
        {}
      ]
    }
  ]
}

 
11 REPLIES 11

Manoj901
New Contributor
New Contributor

Here is the result of my create ticket :

{
    "result": {
        "parent""",
        "made_sla""true",
        "caused_by""",
        "watch_list""",
        "upon_reject""cancel",
        "sys_updated_on""2023-04-23 16:00:02",
        "child_incidents""0",
        "hold_reason""",
        "origin_table""",
        "task_effective_number""INC0010028",
        "approval_history""",
        "number""INC0010028",
        "resolved_by""",
        "sys_updated_by""admin",
        "opened_by": {
            "value""6816f79cc0a8016401c5a33be04be441"
        },
        "user_input""",
        "sys_created_on""2023-04-23 16:00:02",
        "sys_domain": {
            "value""global"
        },
        "state""1",
        "route_reason""",
        "sys_created_by""admin",
        "knowledge""false",
        "order""",
        "calendar_stc""",
        "closed_at""",
        "cmdb_ci""",
        "delivery_plan""",
        "contract""",
        "impact""3",
        "active""true",
        "work_notes_list""",
        "business_service""",
        "business_impact""",
        "priority""5",
        "sys_domain_path""/",
        "rfc""",
        "time_worked""",
        "expected_start""",
        "opened_at""2023-04-23 16:00:02",
        "business_duration""",
        "group_list""",
        "work_end""",
        "caller_id""",
        "reopened_time""",
        "resolved_at""",
        "approval_set""",
        "subcategory""",
        "work_notes""",
        "universal_request""",
        "short_description""",
        "close_code""",
        "correlation_display""",
        "delivery_task""",
        "work_start""",
        "assignment_group""",
        "additional_assignee_list""",
        "business_stc""",
        "cause""",
        "description""",
        "origin_id""",
        "calendar_duration""",
        "close_notes""",
        "notify""1",
        "service_offering""",
        "sys_class_name""incident",
        "closed_by""",
        "follow_up""",
        "parent_incident""",
        "sys_id""cd1e7f7a1b52611075f843f8cd4bcb74",
        "contact_type""",
        "reopened_by""",
        "incident_state""1",
        "urgency""3",
        "problem_id""",
        "company""",
        "reassignment_count""0",
        "activity_due""",
        "assigned_to""",
        "severity""3",
        "comments""",
        "approval""not requested",
        "sla_due""",
        "comments_and_work_notes""",
        "due_date""",
        "sys_mod_count""0",
        "reopen_count""0",
        "sys_tags""",
        "escalation""0",
        "upon_approval""proceed",
        "correlation_id""",
        "location""",
        "category""inquiry"
    }
}

{
 
  "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": [
 
        {}
      ]
    }
  ]
}


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

saikanumuri
Saviynt Employee
Saviynt Employee

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?

Manu269
All-Star
All-Star

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": [
{}
]
}
]
}

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

Hi Manish,

I am still getting the error, after passing "ticketStatusPath": "result[0].close_code",

 

Regards,

Manoj

Manu269
All-Star
All-Star

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.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

Hi Manu,

I have change the field close_code to return the status fo the ticket and here it is.

Manoj901_0-1683607933099.png

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",

}
}]
}

Hi Team,

any help here would be appreciated

Regards,

Mano

kmashwini
New Contributor III
New Contributor III

Any update on this ... I am getting ticket status in Provisioning MetaData

{"accountComments":"Closed Complete"} but stilll pending task is not getting closed. any solution on this?

No Dear, still i have the same issue

Share latest Ticket status json


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.