12/26/2022
04:38 AM
- last edited on
12/26/2022
09:32 AM
by
Dave
Hi Team,
I have requirement for creating ticket in ServiceNow where we need to call 2 jsons under create ticket json one for getting the data and the other is to create it with 2 different APIs.
Below are the APIs provided by client with is working in postman:
The body in POST method should contain the below parameters:
12/26/2022 04:40 AM
Error in logs:
ERROR rest.RestProvisioningService - Error in createNewServiceTicketjava.lang.NullPointerException: Cannot invoke method startsWith() on null object\n","stream":"stdout","time":"2022-12-26T12:33:14.095095788Z"}"
12/26/2022 07:26 AM
One of the value is coming as blank
12/28/2022 11:19 PM
Hi,
How can we achieve it? Any idea.
Regards,
Ekata
12/29/2022 04:26 AM
Can you store requestor for in dynamic attribute and try instead of multi call
12/29/2022 05:02 AM
Hi,
Are you saying to assign it as variable like below:
"accountIdPath":"call1.message.result.sys_id"
Or is there anything else which I am missing.
Regards,
Ekata
01/09/2023 03:44 AM
Hi @rushikeshvartak I work with Ekata who created this discussion. the reason why we are doing multi calls are to get the sys_id of individual user object from servicenow which is later used for creating the service request. In postman we are able to do this in two calls one with GET call which returen sys_id of a users when passed username as query string.
In second call we will use sys_id of servicenow and create request item in snow. So in of the forum link (https://forums.saviynt.com/t5/general-discussions/multiple-api-calls-for-rest-connector-in-createacc...)they did the same and mentioned it is working. But in our case it is not working. In the logs it is returning Null pointer exceptions. So it is unclear what is not getting passed. we also verified connection that is working well.
It would be very helpful if we can get some help here from saviynt side.
Thanks
Sampath
01/09/2023 09:16 AM - edited 01/09/2023 09:19 AM
Can you post the call1 output? Also for testing purpose did you try to hardcord the sys_id of requestor in requested_for parameter of call2 and see if that works?
01/13/2023 12:05 AM
Hi @sk I hope you have checked my below responses which answers your queries. So please let us know if you can assist us on this issue.
Thanks
01/09/2023
11:16 PM
- last edited on
01/10/2023
09:31 AM
by
Dave
Hi,
Yes, below is postman output of call1.
during call1 we have to pass username as query string in the url, So below is how we tried to do. can you please verify is it right way to pass username in url
"https://******dev.service-now.com/api/now/table/sys_user?sysparm_query=active%3Dtrue%5Euser_name%3D${user.username}&sysparm_display_value=true&sysparm_fields=first_name,last_name,user_name,email,sys_id&sysparm_limit=1",
{
"call": [
{
"name":"call1",
"connection":"userAuth",
"url":"https://domaindev.service-now.com/api/sn_sc/servicecatalog/items/801dfde6db9bd700677d3437b996198e/or...",
"httpMethod":"POST",
"httpParams":"{\"sysparm_quantity\":\"1\",\"variables\":{\"case_code\":\"06f9b8fa1b9360108c122066b04bcb30\",\"request_type\":\"Request a Desktop\",\"requested_for\":\"d2f3055a1b73095007da62c6b04bcb82\",\"physical_location\":\"EU2\"}}",
"httpHeaders":{
"Authorization":"Basic **********"
},
"httpContentType": "application/json",
"ticketidPath": "result.request_number",
"ticketStatusValue": [
"Closed",
"Closed Complete",
"Resolved"
],
"disContinueStatusValue": [
"Closed Incomplete",
"Closed Skipped"
],
"successResponses": {
"statusCode": [
200,
201
]
},
"unsuccessResponses":{
"message":"Operation Failed"}
}
]
}
Thanks
Sampath
[This post has been edited by a Moderator to remove sensitive information.]