Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

TicketStatusJSON not working as expected

Diego
New Contributor II
New Contributor II

I am looking to create a request in ServiceNow and after running WSRETRY provisioning job for a task in Saviynt. I do not want that task to process and complete until the ServiceNow request is closed. Currently I can create a simple request after running WSRETRY provisioning job using the CreateTicketJSON. However, my task gets automatically marked as completed even when the ServiceNow request is still open. I believe my TicketStatusJSON is not working properly. I will add my TicketStatus & CreateTicket JSONs below. Am I doing something wrong?

CreateTicketJSON:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://----/api/now/table/sc_req_item",
"httpMethod": "POST",
"httpParams": "{\"cat_item\":\"Other Services\", \"comments\":\"Test\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "result.number",
"ticketStatusPath": "result.state",
"ticketStatusValue": [
"Open",
"OPEN",
"open"
],
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}

TicketStatusJSON:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://----/api/now/table/sc_req_item?sysparm_query=sysparm_query=request.number=${ticketID}&sysparm_limit=1&ysparm_display_value=true&sysparm_limit=1",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].state",
"ticketStatusValue":[
"Open",
"OPEN",
"open"
],
"successResponses": [
{}
]
}
]
}

15 REPLIES 15

SB
Saviynt Employee
Saviynt Employee

Can you update the ticketStatusValue that reflects to a closed value in Target application in place of Open value you have defined.


Regards,
Sahil

Diego
New Contributor II
New Contributor II

I tried that as well but I had no luck. 

I attempted changing my createTicket & TicketStatus JSON to create tasks instead of RITM and now I get the issue where a "add access" task will remain in "Pending Provision" status even after the ticket is closed in ServiceNow. Here is that JSON:
Create JSON:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://-----/api/now/table/sc_task",
"httpMethod": "POST",
"httpParams": "{\"bp_id\":\"$user.username\",\"name\":\"$user.lastname, $user.firstname\",\"email\":\"$user.email\",\"priority\":\"2\",\"assignment_group\":\"Identity\",\"short_description\": \"Please certify access for the user\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketidPath": "result.number",
"unsuccessResponses": {
"message": "Ticket Creation Failed"
}
}
]
}

Ticket JSON:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://------/api/now/table/sc_task?sysparm_query=number=${ticketID}&sysparm_limit=1&sparm_display_value=true",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].state",
"ticketStatusValue": [
"Open",
"OPEN",
"open"
],
"successResponses": [
{}
]
}
]
}

SB
Saviynt Employee
Saviynt Employee

Can you update the above TicketstatusJSON with the below and run the job. Also, keep the above CreateTicketJSON as is.

"ticketStatusPath": "result.state",
"ticketStatusValue": [
"1"
]


Regards,
Sahil

Diego
New Contributor II
New Contributor II

Tried that just now and it looks like I am getting the following error. Any idea how to fix it? 

 

2023-06-21 17:54:31,199 [quartzScheduler_Worker-2] ERROR services.ArsTaskService - Exception
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';Ticket Number=TASK1321170; WHERE ACCOUNTKEY=4307654' at line 1

DixshantValecha
Saviynt Employee
Saviynt Employee

Please find below the modified TicketStatusJSON:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://------/api/now/table/sc_task?sysparm_query=number=${ticketID}&sysparm_limit=1&sysparm_display_value=true",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"ticketStatusPath": "result[0].state",
"ticketStatusValue": ["3"],
"successResponses": [{}]
}
]
}

Please validate and let us know if further assistance is needed.

No luck. Here is what I am seeing in the error logs. It might be an issue with Saviynt bring in an extra ";" when fetching the Ticket Number. 

 

2023-06-14 18:20:52,429 [quartzScheduler_Worker-2] ERROR rest.RestProvisioningService - Call response: {"result":{"parent":"","made_sla":"true","watch_list":"","sc_catalog":"","upon_reject":"cancel","sys_updated_on":"2023-06-14 18:20:52","task_effective_number":"TASK1321080","approval_history":"","skills":"","number":"TASK1321080","sys_updated_by":"svc_saviynt","opened_by":{"link":"https://-----.com/api/now/table/sys_user/52d511221b7e38509d9963dce54bcb46","value":"52d511221b7e38509d9963dce54bcb46"},"user_input":"","sys_created_on":"2023-06-14 18:20:52","sys_domain":{"link":"https://-----/api/now/table/sys_user_group/global","value":"global"},"state":"1","route_reason":"","sys_created_by":"svc_saviynt","knowledge":"false","order":"","u_resource_level_of_effort":"1","calendar_stc":"","closed_at":"","cmdb_ci":"","delivery_plan":"","u_work_notes_summary":"","contract":"","impact":"3","active":"true","work_notes_list":"","business_service":"","priority":"2","time_worked":"","expected_start":"","u_process_name":"","opened_at":"2023-06-14 18:20:52","business_duration":"","group_list":"","work_end":"","approval_set":"","work_notes":"","universal_request":"","request":"","short_description":"Please certify access for the user","u_reason_codes":"","correlation_display":"","delivery_task":"","work_start":"2023-06-14","assignment_group":{"link":"https://-----/api/now/table/sys_user_group/247b23d51b059450cb59db9ee54bcb89","value":"247b23d51b059450cb59db9ee54bcb89"},"additional_assignee_list":"","description":"","calendar_duration":"","close_notes":"","service_offering":"","sys_class_name":"sc_task","closed_by":"","follow_up":"","sys_id":"43f0d4b31b9be550e8dc63dce54bcbc9","contact_type":"","u_accessible_to":"-,-,-,-,247b23d51b059450cb59db9ee54bcb89","urgency":"3","company":"","reassignment_count":"0","activity_due":"","assigned_to":"","comments":"","approval":"not requested","sla_due":"","comments_and_work_notes":"","due_date":"","sys_mod_count":"0","request_item":"","sys_tags":"","escalation":"0","upon_approval":"proceed","correlation_id":"","location":""}}
2023-06-14 18:20:52,429 [quartzScheduler_Worker-2] ERROR rest.RestProvisioningService - callResponseMap: [result:[parent:, made_sla:true, watch_list:, sc_catalog:, upon_reject:cancel, sys_updated_on:2023-06-14 18:20:52, task_effective_number:TASK1321080, approval_history:, skills:, number:TASK1321080, sys_updated_by:svc_saviynt, opened_by:[link:https://-----/api/now/table/sys_user/52d511221b7e38509d9963dce54bcb46, value:52d511221b7e38509d9963dce54bcb46], user_input:, sys_created_on:2023-06-14 18:20:52, sys_domain:[link:https://------/api/now/table/sys_user_group/global, value:global], state:1, route_reason:, sys_created_by:svc_saviynt, knowledge:false, order:, u_resource_level_of_effort:1, calendar_stc:, closed_at:, cmdb_ci:, delivery_plan:, u_work_notes_summary:, contract:, impact:3, active:true, work_notes_list:, business_service:, priority:2, time_worked:, expected_start:, u_process_name:, opened_at:2023-06-14 18:20:52, business_duration:, group_list:, work_end:, approval_set:, work_notes:, universal_request:, request:, short_description:Please certify access for the user, u_reason_codes:, correlation_display:, delivery_task:, work_start:2023-06-14, assignment_group:[link:https://------/api/now/table/sys_user_group/247b23d51b059450cb59db9ee54bcb89, value:247b23d51b059450cb59db9ee54bcb89], additional_assignee_list:, description:, calendar_duration:, close_notes:, service_offering:, sys_class_name:sc_task, closed_by:, follow_up:, sys_id:43f0d4b31b9be550e8dc63dce54bcbc9, contact_type:, u_accessible_to:-,-,-,-,247b23d51b059450cb59db9ee54bcb89, urgency:3, company:, reassignment_count:0, activity_due:, assigned_to:, comments:, approval:not requested, sla_due:, comments_and_work_notes:, due_date:, sys_mod_count:0, request_item:, sys_tags:, escalation:0, upon_approval:proceed, correlation_id:, location:]]
2023-06-14 18:20:53,373 [quartzScheduler_Worker-2] ERROR ldap.SaviyntGroovyLdapService - Error in getAccountDnAttrList : No such property: ImportUtilityService for class: com.saviynt.ldap.SaviyntGroovyLdapService
Possible solutions: importUtilityService
2023-06-14 18:20:55,975 [quartzScheduler_Worker-2] ERROR services.ArsTaskService - Exception
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';Ticket Number=TASK1321080; WHERE ACCOUNTKEY=4046930' at line 1
at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1062)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4208)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4140)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2597)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2758)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2820)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1759)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1679)
at com.saviynt.ldap.SaviyntGroovyLdapService.updateLdapAccountFromProvMetadata(SaviyntGroovyLdapService.groovy:5078)
at com.saviynt.ecm.services.ArsTaskService.updateAccFromProvMetadata(ArsTaskService.groovy:13522)
at com.saviynt.ecm.services.ArsTaskService$_provisionAccesstoAccountSaviynt_closure152_closure281.doCall(ArsTaskService.groovy:11760)
at com.saviynt.ecm.services.ArsTaskService$_provisionAccesstoAccountSaviynt_closure152.doCall(ArsTaskService.groovy:11147)
at com.saviynt.ecm.services.ArsTaskService.provisionAccesstoAccountSaviynt(ArsTaskService.groovy:11118)
at com.saviynt.ecm.services.ArsTaskHelperService$_whenTaskTypeIsOneAddAccess_closure45.doCall(ArsTaskHelperService.groovy:2738)
at com.saviynt.ecm.services.ArsTaskHelperService.whenTaskTypeIsOneAddAccess(ArsTaskHelperService.groovy:2722)
at com.saviynt.ecm.services.ArsTaskHelperService$_completeAutoProvTasksUpgraded_closure1.doCall(ArsTaskHelperService.groovy:152)
at com.saviynt.ecm.services.ArsTaskHelperService.completeAutoProvTasksUpgraded(ArsTaskHelperService.groovy:147)
at MultipleProvisioningJob.execute(MultipleProvisioningJob.groovy:222)
at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)

This seems code issue where mysql not able to update status properly can you share postman screenshot of ticket response 


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

Here you go....The request_state attribute holds the values....which we are using for request closure calculation
{
    "result": {
        "parent": "",
        "delivery_address": "",
        "made_sla": "true",
        "watch_list": "",
        "upon_reject": "cancel",
        "requested_for": {
            "value": "9423fbb3551"
        },
        "sys_updated_on": "2023-12-27 13:43:22",
        "task_effective_number": "REQ0061264",
        "approval_history": "",
        "skills": "",
        "number": "REQ0065264",
        "sys_updated_by": "svc.n.itil",
        "opened_by": {
            "value": "9427806387f59e3fbb3551"
        },
        "user_input": "",
        "price": "0",
        "sys_created_on": "2023-12-27 13:43:22",
        "sys_domain": {
            "value": "global"
        },
        "state": "0",
        "route_reason": "",
        "sys_created_by": "svc.itil",
        "knowledge": "false",
        "order": "",
        "calendar_stc": "",
        "special_instructions": "",
        "closed_at": "",
        "cmdb_ci": "",
        "contract": "",
        "impact": "3",
        "active": "true",
        "work_notes_list": "",
        "business_service": "",
        "priority": "3",
        "sys_domain_path": "/",
        "time_worked": "",
        "expected_start": "",
        "opened_at": "2023-12-27 13:43:22",
        "business_duration": "",
        "group_list": "",
        "sourceable": "false",
        "work_end": "",
        "approval_set": "2023-12-27 13:43:22",
        "work_notes": "",
        "u_knowledge_base": "",
        "universal_request": "",
        "short_description": "",
        "correlation_display": "",
        "work_start": "",
        "assignment_group": "",
        "parent_interaction": "",
        "additional_assignee_list": "",
        "description": "",
        "calendar_duration": "",
        "close_notes": "",
        "service_offering": "",
        "sys_class_name": "sc_request",
        "closed_by": "",
        "follow_up": "",
        "sys_id": "f4192472871bf190bdbeb847cebb35fc",
        "contact_type": "",
        "sourced": "false",
        "urgency": "3",
        "requested_date": "",
        "company": "",
        "reassignment_count": "0",
        "u_security_description": "",
        "activity_due": "",
        "assigned_to": "",
        "comments": "",
        "approval": "approved",
        "sla_due": "",
        "comments_and_work_notes": "",
        "due_date": "2023-12-27 13:43:21",
        "sys_mod_count": "0",
        "sys_tags": "",
        "request_state": "in_process",
        "agile_story": "",
        "stage": "requested",
        "escalation": "0",
        "upon_approval": "proceed",
        "correlation_id": "",
        "location": ""
    }
}

SB
Saviynt Employee
Saviynt Employee

Can you confirm if this is still and issue or was this resolved.


Regards,
Sahil

Diego
New Contributor II
New Contributor II

This is still an ongoing issue.

SB
Saviynt Employee
Saviynt Employee

Can you run this via postman and share the output in a text file. Alternatively, can you update ConfigJSON param in the REST connection with value {"showLogs":true}. Run the prov job and share the logs for it.


Regards,
Sahil

sabthamis
New Contributor
New Contributor

Hello,

Is this issue is resolved. I have the same issue the task in Saviynt are not closed it shows as pending provision ?

 

Any help here

 

@Diego @SB @DixshantValecha 

Diego
New Contributor II
New Contributor II

The issue was not resolved

then, Is this a product issue /bug ?

RanjanS
New Contributor
New Contributor

Hi Diego,

Check for the security system, you might have mapped Service Desk Connection and Provisioning Connection both.

If that is the case, please remove provisioning connection and try. Do let us know if it resolved the issue.

Thanks,

Ranjan