Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Servicenow ImportaccountEnt Json not working with multiple accountParams calls

sampath18
Regular Contributor II
Regular Contributor II

Hi Team,

I have a usecase to import user accounts from servicenow. Single call for importing accounts is working as expected. But in our requirement we have to make two calls. call1 is to get user profile information and using sys_id returned by call1 we need to make another call to look for asset information of the user as call2. I have written following json for the same by following connector guide. But this one is not working. It is giving below error. How do i make response of call1 used in call2 in this case? Appreciate your response.

 

Error:

with class 'java.util.ArrayList' to class
'java.util.Map' due to:
groovy.lang.GroovyRuntimeException: Could not find
matching constructor for:
java.util.Map(java.util.LinkedHashMap,
java.util.LinkedHashMap)

 

{
"accountParams": {
"connection": "userAuth",
"processingType": "SequentialAndIterative",
"call": [
{
"name":"call1",
"callOrder": 0,
"stageNumber": 0,
"http": {
"url":"https://domain.service-now.com/api/now/table/sys_user?user_name=${user?.username}&sysparm_fields=fir...",
"httpMethod":"GET",
"httpParams":"{\"sysparm_display_value\":\"true\"}",
"httpHeaders": {
"Authorization": "Basic XXXXXXXXX"
},

"httpContentType": "application/json"

},
"statusConfig": {
"active": "true",
"inactive": "false"
},
"listField": "result",
"keyField": "accountID",
"colsToPropsMap": {
"customproperty1": "employee_number~#~char",
"CUSTOMPROPERTY2": "last_name~#~char",
"customproperty3": "name~#~char",
"CUSTOMPROPERTY4": "first_name~#~char",
"CUSTOMPROPERTY7": "email~#~char",
"name": "user_name~#~char",
"accountID": "sys_id~#~char"
},
"pagination": {
"nextUrl": {
"nextUrlPath": "${headers?.Link?.split(';')?.size()==5?headers?.Link?.split(';')[2]?.replace('rel=\"prev\",<', '')?.replace('>','')?.trim():headers?.Link?.split(';')?.size()==4 && headers?.Link?.split(';')[2].contains('rel=\"next\",<')?headers?.Link?.split(';')[1]?.replace('rel=\"first\",<', '')?.replace('>','')?.trim():null}"
}
}
},

{
"name":"call2",
"callOrder": 1,
"stageNumber": 0,
"connection":"userAuth",
"url":"https://domain.service-now.com/api/now/table/alm_hardware",
"httpMethod":"GET",
"httpParams":"{\"sysparm_query\":\"install_status%3D1%5Eassigned_to%3D${response.call1.message.result.sys_id}\",\"sysparm_display_value\":\"true\",\"sysparm_fields\":\"serial_number,asset_tag,model,install_status,assigned_to\"}",
"httpHeaders":{
"Authorization":"Basic xxxxxxxx",
"Accept":"application/json"
},
"httpContentType": "application/json",
"listField": "result",
"keyField": "accountID",
"colsToPropsMap": {
"customproperty8": "asset_tag~#~char",
"name": "call1.message.result.user_name~#~char",
"accountID": "call1.message.result.sys_id~#~char"
}
}
]
}
}

13 REPLIES 13

SB
Saviynt Employee
Saviynt Employee

Can you check the logs to see if the data is being read for call 1 (search for string Got Webservice API Response:). If you do see the data of users in response of call1, search for the next string Calling Webservice Url - for call2 and this should display the payload being sent from Saviynt. This will help identify if the response is being read from Call 1 and passed to call 2.

Request you to share the snippet of both calls.

You may need to enable addiotnal logging. Update Connection and add value {"showLogs":true} for Config json param


Regards,
Sahil

sampath18
Regular Contributor II
Regular Contributor II

Hi Sahil,

Thanks for the response. With call1 alone i have tried importing an user account and API had returned below response. But regarding call2 i am unable to get any response and throwing above error. However i can provide POSTMAN response for the call2 . please find the same below.

Main problem here is I wanted to know how we can pass the sys_id for the multiple user objects returned in call1 to call2. Because this is for the importing account into saviynt. is this possible to do in the importaccountjson?

 

ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - Inside pullObjectsByRest\n","stream":"stdout","time":"2023-03-07T08:30:25.971540864Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG rest.RestUtilService - Got showLogs = true\n","stream":"stdout","time":"2023-03-07T08:30:25.97157227Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://baincodev.service-now.com/api/now/table/sys_user?user_name=58699\u0026sysparm_fields=first_name,last_name,user_name,email,sys_id with httpParams - {\"sysparm_display_value\":\"true\"}\n","stream":"stdout","time":"2023-03-07T08:30:25.971577445Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG services.HttpClientUtilityService - isFipsEnabled = false\n","stream":"stdout","time":"2023-03-07T08:30:25.971584633Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG services.HttpClientUtilityService - getHttpClient - sslParams : null\n","stream":"stdout","time":"2023-03-07T08:30:25.971587641Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG services.HttpClientUtilityService - getHttpClient - proxyParams : null\n","stream":"stdout","time":"2023-03-07T08:30:25.971590269Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,971 [quartzScheduler_Worker-9] DEBUG services.HttpClientUtilityService - getHttpClient - sslSocketFactory : null\n","stream":"stdout","time":"2023-03-07T08:30:25.97159301Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:25,989 [quartzScheduler_Worker-9] DEBUG services.HttpClientUtilityService - getHttpClient - HttpClientBuilder.create().build() called.\n","stream":"stdout","time":"2023-03-07T08:30:25.989221199Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:26,071 [quartzScheduler_Worker-9] DEBUG rest.RestUtilService - Got showLogs = true\n","stream":"stdout","time":"2023-03-07T08:30:26.071837384Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:26,071 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - Got Webservice API Response: [headers:[Server: snow_adc, Date: Tue, 07 Mar 2023 08:30:26 GMT, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Set-Cookie: BIGipServerpool_baincodev=3284c79f9d11f78ccbb855311b9dae14; httponly; secure; path=/; SameSite=None, Set-Cookie: JSESSIONID=1AFCA9D4010798566AE9B253FC4D5640; Path=/; HttpOnly; secure; SameSite=None, Server-Timing: sem_wait;dur=0, sesh_wait;dur=0, Set-Cookie: glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; secure; SameSite=None, Set-Cookie: glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; secure; SameSite=None, Set-Cookie: glide_user_route=glide.499d70f008fd7e8409cd4ff5260d2448; Max-Age=2147483647; Expires=Sun, 25-Mar-2091 11:44:33 GMT; Path=/; HttpOnly; secure; SameSite=None, X-Is-Logged-In: true, X-Transaction-ID: 057458b3db11, Set-Cookie: glide_session_store=CD7458B3DB11A150849A60ECD39619E6; Max-Age=1800; Expires=Tue, 07-Mar-2023 09:00:26 GMT; Path=/; HttpOnly; secure; SameSite=None, X-Total-Count: 1, Pragma: no-store,no-cache, Cache-Control: no-cache,no-store,must-revalidate,max-age=-1, Expires: 0, Strict-Transport-Security: max-age=63072000; includeSubDomains], responseText:{\"result\":[{\"sys_id\":\"6c4785aa1b498d5820c6caa7624bcb55\",\"user_name\":\"58699\",\"last_name\":\"Bharati\",\"first_name\":\"Ekata\",\"email\":\"T-Ekata.Bharti@bain.com\"}]}, cookies:[BIGipServerpool_baincodev=3284c79f9d11f78ccbb855311b9dae14; httponly; secure; path=/; SameSite=None, JSESSIONID=1AFCA9D4010798566AE9B253FC4D5640; Path=/; HttpOnly; secure; SameSite=None, glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; secure; SameSite=None, glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; secure; SameSite=None, glide_user_route=glide.499d70f008fd7e8409cd4ff5260d2448; Max-Age=2147483647; Expires=Sun, 25-Mar-2091 11:44:33 GMT; Path=/; HttpOnly; secure; SameSite=None, glide_session_store=CD7458B3DB11A150849A60ECD39619E6; Max-Age=1800; Expires=Tue, 07-Mar-2023 09:00:26 GMT; Path=/; HttpOnly; secure; SameSite=None], statusCode:200]\n","stream":"stdout","time":"2023-03-07T08:30:26.071864564Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:26,071 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - pullObjectsByRest - responseStatusCode ::200\n","stream":"stdout","time":"2023-03-07T08:30:26.071882088Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:26,072 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - Entered getResponseHeaders method\n","stream":"stdout","time":"2023-03-07T08:30:26.072293629Z"}"
"ecm-worker","2023-03-07T08:30:26.184+0000","{"log":"2023-03-07 08:30:26,072 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - responseError : null\n","stream":"stdout","time":"2023-03-07T08:30:26.072410627Z"}"

 

 

Call2 Response from postman


{
"result": [
{
"asset_tag": "B*****",
"install_status": "In use",
"serial_number": "*8888",
"model": {
"display_value": "Lenovo ThinkPad X1 Yoga 3rd",
"link": "https://domain.service-now.com/api/now/table/cmdb_model/54a4b44c1b54ac5020c6caa7624bcb63"
},
"assigned_to": {
"display_value": "Name",
"link": "https://Domain.service-now.com/api/now/table/sys_user/809b4d651bb27c5082f7a686624bcb3e"
}
}
]
}

 

Thanks
Sampath

SB
Saviynt Employee
Saviynt Employee

Can you try with the below format once. If this does not work, can you also try without the pagination.

{
"accountParams": {
"connection": "userAuth",
"processingType": "SequentialAndIterative",
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://domain.service-now.com/api/now/table/sys_user?user_name=${user?.username}&sysparm_fields=fir...",
"httpMethod": "GET",
"httpParams": "{\"sysparm_display_value\":\"true\"}",
"httpHeaders": {
"Authorization": "Basic XXXXXXXXX"
},
"httpContentType": "application/json"
},
"statusConfig": {
"active": "true",
"inactive": "false"
},
"listField": "result",
"keyField": "accountID",
"colsToPropsMap": {
"customproperty1": "employee_number~#~char",
"CUSTOMPROPERTY2": "last_name~#~char",
"customproperty3": "name~#~char",
"CUSTOMPROPERTY4": "first_name~#~char",
"CUSTOMPROPERTY7": "email~#~char",
"name": "user_name~#~char",
"accountID": "sys_id~#~char"
},
"pagination": {
"nextUrl": {
"nextUrlPath": "${headers?.Link?.split(';')?.size()==5?headers?.Link?.split(';')[2]?.replace('rel=\"prev\",<', '')?.replace('>','')?.trim():headers?.Link?.split(';')?.size()==4 && headers?.Link?.split(';')[2].contains('rel=\"next\",<')?headers?.Link?.split(';')[1]?.replace('rel=\"first\",<', '')?.replace('>','')?.trim():null}"
}
}
},
"call2": {
"callOrder": 1,
"stageNumber": 3,
"connection": "userAuth",
"url": "https://domain.service-now.com/api/now/table/alm_hardware",
"httpMethod": "GET",
"httpParams": "{\"sysparm_query\":\"install_status%3D1%5Eassigned_to%3D${response.call1.message.result.sys_id}\",\"sysparm_display_value\":\"true\",\"sysparm_fields\":\"serial_number,asset_tag,model,install_status,assigned_to\"}",
"httpHeaders": {
"Authorization": "Basic xxxxxxxx",
"Accept": "application/json"
},
"httpContentType": "application/json",
"inputParams": {
"dependentCall": true
},
"listField": "result",
"keyField": "accountID",
"colsToPropsMap": {
"customproperty8": "asset_tag~#~char",
"name": "call1.message.result.user_name~#~char",
"accountID": "call1.message.result.sys_id~#~char"
}
}
}
}
}


Regards,
Sahil

sampath18
Regular Contributor II
Regular Contributor II

Hi Sahil,

I see different error now. same error is coming with or without pagination param.

"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"2023-03-07 16:40:00,456 [quartzScheduler_Worker-1] DEBUG rest.RestProvisioningService - processAccountsFullBySequentialAndIterative - Not Multitrigger call \n","stream":"stdout","time":"2023-03-07T16:40:00.456998093Z"}"
"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"2023-03-07 16:40:00,457 [quartzScheduler_Worker-1] DEBUG rest.RestProvisioningService - Exception in processAccountsFullBySequentialAndIterative :\n","stream":"stdout","time":"2023-03-07T16:40:00.457185244Z"}"
"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"java.lang.NullPointerException: Cannot set property 'httpUrlBindingMap' on null object\n","stream":"stdout","time":"2023-03-07T16:40:00.457190869Z"}"
"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"\u0009at com.saviynt.provisoning.rest.RestProvisioningService.processAccountsFullBySequentialAndIterative(RestProvisioningService.groovy:1583)\n","stream":"stdout","time":"2023-03-07T16:40:00.457193975Z"}"
"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"\u0009at com.saviynt.provisoning.rest.RestProvisioningService.importAccountsFull(RestProvisioningService.groovy:1423)\n","stream":"stdout","time":"2023-03-07T16:40:00.457196887Z"}"
"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"\u0009at com.saviynt.provisoning.rest.RestProvisioningService.doImport(RestProvisioningService.groovy:137)\n","stream":"stdout","time":"2023-03-07T16:40:00.457199817Z"}"
"ecm-worker","2023-03-07T16:40:01.184+0000","{"log":"\u0009at com.saviynt.ecm.integration.ExternalConnectionCallService.invokeExternalMethod(ExternalConnectionCallService.groovy:228)\n","stream":"stdout","time":"2023-03-07T16:40:00.457202853Z"}"

Thanks,
Sampath

SB
Saviynt Employee
Saviynt Employee

Can you replace {response.call1.message.result.sys_id} with {accountID}  or ${account.accountID} in the json format I shared previously and see if it works.

Also, can you share the logs from below thread in case it still does not work.

Calling Webservice Url - https://domain.service-now.com/api/now/table/alm_hardware with httpParams


Regards,
Sahil

sampath18
Regular Contributor II
Regular Contributor II

Hi sahil, 

I am attaching the log file for your reference. the issue in call2 only. 

Also, We can not use  {accountID}  or ${account.accountID} in place of sys_id, because it returns null response when tested from postman.

Thanks

Sampath

 

SB
Saviynt Employee
Saviynt Employee

Based on the above mapping I see that you are storing sys_id in AccountID field. So we should be able to use AccountID in the 2nd call as it would resolve to your actual sys_id value. And because we are using dependentcall parameter, it should work.


Regards,
Sahil

sampath18
Regular Contributor II
Regular Contributor II

Hi Sahil,

Thanks for explaining it. But still no change in error. we are still getting same response.

Error - to Import Data correctly: Cannot set
property 'httpUrlBindingMap' on null object

Regards,
Sampath

SB
Saviynt Employee
Saviynt Employee

Do you see  {accountID}  or ${account.accountID}  getting resolved to the actual value to be sent in the logs.

 


Regards,
Sahil

sampath18
Regular Contributor II
Regular Contributor II

No, it is not getting resolved. I also hardcoded the sys_id parameter as i was doing for single user. Still we are getting the same error as before. So i feel there is something wrong in call2 only.

 

 

Inside importAccountsFull:persistAccounts, pptTypeSep : ~#~\n","stream":"stdout","time":"2023-03-09T05:05:22.692713617Z"}"
"ecm-worker","2023-03-09T05:05:23.269+0000","{"log":"2023-03-09 05:05:22,803 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - callStageNumber : 3\n","stream":"stdout","time":"2023-03-09T05:05:22.804050964Z"}"
"ecm-worker","2023-03-09T05:05:23.269+0000","{"log":"2023-03-09 05:05:22,803 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - callStageNumber: 3\n","stream":"stdout","time":"2023-03-09T05:05:22.804088555Z"}"
"ecm-worker","2023-03-09T05:05:23.269+0000","{"log":"2023-03-09 05:05:22,803 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - stageNumber: null\n","stream":"stdout","time":"2023-03-09T05:05:22.804093362Z"}"
"ecm-worker","2023-03-09T05:05:23.269+0000","{"log":"2023-03-09 05:05:22,804 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - processAccountsFullBySequentialAndIterative - Not Multitrigger call \n","stream":"stdout","time":"2023-03-09T05:05:22.804096847Z"}"
"ecm-worker","2023-03-09T05:05:23.269+0000","{"log":"2023-03-09 05:05:22,804 [quartzScheduler_Worker-9] DEBUG rest.RestProvisioningService - Exception in processAccountsFullBySequentialAndIterative :\n","stream":"stdout","time":"2023-03-09T05:05:22.804300494Z"}"
"ecm-worker","2023-03-09T05:05:23.269+0000","{"log":"java.lang.NullPointerException: Cannot set property 'httpUrlBindingMap' on null object\n","stream":"stdout","time":"2023-03-09T05:05:22.804321482Z"}"

 

 

Thanks
Sampath

SB
Saviynt Employee
Saviynt Employee

This might require additional troubleshooting. Can you open a Saviynt support ticket.


Regards,
Sahil

sampath18
Regular Contributor II
Regular Contributor II

Hi Sahil,

I have already opened the FD ticket 1607550. I am not sure if  I can ask you to check this ticket.

Thanks
Sampath

SB
Saviynt Employee
Saviynt Employee

The Saviynt support team will check the FD and update.


Regards,
Sahil