and more in a single search tool across platforms. Read the announcement here. |
04/20/2023 03:52 AM
Hi All,
I wanted to check that in rest connector while importing accounts into EIC we would map the required attributes from EIC to Target Application attribbutes. but we have one use case where we are doing multi calls for servicenow import accounts. there are two calls call 1 and call2.
In call1 we are getting users details which includes username and accountid, but in call2 we do not get username and accountid in the response, so how to use call1 response attributes in call2 for the variable colsToPropsMap . in call2 we have extra user information which we need to map to same account object in EIC
Another thing in colsToPropsMap , can we assign constant value to EIC attribute
E.g:
"colsToPropsMap" :{
EICAttribte : X value(constant)
}
Solved! Go to Solution.
04/20/2023 04:48 AM
#CONST is used for constant
"sox_critical": "#CONST#4~#~char",
04/20/2023 04:49 AM
For response in call2
call1.response.id
04/20/2023 05:06 AM
Thanks @marc_rushi
is it possible to use call1 responses in call 2 colsTopropsMap like below.
"colsToPropsMap":{
"accountID":"${call1.response.sys_id}~#~char",
"CUSTOMPROPERTY8":"asset_tag~#~char"
}
can you tell me is there a synatx we need to follow for this. because above way it is not working.
So keen to know if there is a way to do it.
Thanks
Sampath
04/20/2023 07:03 AM
call1 response in not getting passed to call2 when with below response paths.
${response.call1.message.result.sys_id}
${response.call1.message.sys_id}
${call1.response.sys_id}
It is giving error as NullResponseFromTarget . But at the same hardcoded value is working. So can you assist what is going wrong here.
"http":{
"url":"https://dev.service-now.com/api/now/table/alm_hardware?sysparm_query=install_status%3D1%5Eassigned_t...}",
"httpMethod":"GET",
"httpParams":"{\"sysparm_display_value\":\"true\",\"sysparm_fields\":\"serial_number%2Casset_tag%2Cmodel%2Cinstall_status%2Cassigned_to\"}",
"httpHeaders":{
"Authorization":"Basic ########"
"Accept":"application/json"
},
Also pasting the full JSOn for reference.
{
"accountParams":{
"connection":"userAuth",
"processingType":"SequentialAndIterative",
"call":{
"call1":{
"callOrder":0,
"stageNumber":0,
"http":{
"url":"https://odev.service-now.com/api/now/table/sys_user?user_name=56607&sysparm_fields=first_name,last_n...",
"httpMethod":"GET",
"httpParams":"{\"sysparm_display_value\":\"true\"}",
"httpHeaders":{
"Authorization":"Basic #######"
},
"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":1,
"connection":"userAuth",
"http":{
"url":"https://dev.service-now.com/api/now/table/alm_hardware?sysparm_query=install_status%3D1%5Eassigned_t...}",
"httpMethod":"GET",
"httpParams":"{\"sysparm_display_value\":\"true\",\"sysparm_fields\":\"serial_number%2Casset_tag%2Cmodel%2Cinstall_status%2Cassigned_to\"}",
"httpHeaders":{
"Authorization":"Basic ########",
"Accept":"application/json"
},
"httpContentType":"application/json"
},
"inputParams":{
"dependentCall":true
},
"listField":"result",
"keyField":"accountID",
"nextApiKeyField":"accountID",
"colsToPropsMap":{
"name": "${call1.response.user_name}~#~char",
"accountID":"${call1.response.sys_id}~#~char",
"CUSTOMPROPERTY8":"asset_tag~#~char"
}
}
}
}
}
Thanks
04/20/2023 08:13 AM
The colsToPropsMap is used to map the target application attributes with Saviynt. Since you have already mapped name and accountID in your Call1, you would not need to map them again. The value for these attributes will be saved in Saviynt as part of Call1.
04/20/2023 08:21 AM
Hi @SB Yes, we have mapped name and accountID attributes in call1. But in call2 we have few more attributes to map to complete the usecase. So how to achieve mapping of call2 additional attributes to same accountID in saviynt. This is where it is not clear.
In our usecase we are importing accounts from service now but while importing we have to look for additional attributes and we are getting them in call2. So end result should be all attributes from call1 and call2 assigned into Account in EIC.
Hope i am clear with my requirement.
Thanks
Sampath
04/20/2023 09:11 AM
The logic for mapping of 2nd call will also work similar to Call1. There needs to be a unique identifier (sys_id) in the call2 response to configure listfield and keyfield value. Based on these value you can map the additional attributes.
04/20/2023 09:40 AM
But unfortunately the call2 is not returning the same sys_id of call1. That's where the complexity.
So the call2 is returning other unique fields which are not present in call1. Hence i wanted to check if there is a way to use call1 returned attributes in call2 colsTopropMap.
Thanks
04/20/2023 09:44 AM
Is there any unique identifier common between call1 and call2. I believe there should be else there would not be a way to know which values belong to which account. So using response from call1 will not work as an identifier to know which value belongs to which account.
04/20/2023 09:51 AM
yes, there is no direct common attributes between call1 and call2. But in call2 we get a link attribute which contains the sys_id in it , but unable to use that in colsToPropMap.
Below are the call1 and call2 responses
04/20/2023 10:43 AM
Does this mean that call2 will be executed for each user individually?
04/21/2023 12:45 AM
Hi @SB yes, call2 is dependent call for call1. so it has to execute for each user based on call1 response.
04/20/2023 10:58 AM - edited 04/20/2023 10:59 AM
@sampath18 Can you try with the below colsToPropsMap for call2 and see if it works.
"colsToPropsMap":{
"accountID": "#CONST#${String acctId = assigned_to.link; acctId = acctId.replace('https://dev.service-now.com/api/now/table/sys_user/', ''); return acctId}~#~char",
"CUSTOMPROPERTY8":"asset_tag~#~char"
Please also update ConfigJSON param in the REST connection with value {"showLogs":true} if not done already before running the job. I would recommend if you could run the import for only 1 user so we have less data in logs to troubleshoot further; if needed.
04/21/2023 01:10 AM
Hi @SB
Above solution did not work. when executed with above logic it created new account with accountID attribute as "${String acctId = assigned_to.link; acctId = acctId.replace('https://dev.service-now.com/api/now/table/sys_user/', ''); return acctId}"
This what i tried earlier also, but saviynt not resolving the code under colstoPropsMap. is there any syntax we need to be following? when we do not have direct attribute data coming from target application. Like in this case.
Thanks
04/21/2023 02:23 AM
04/21/2023 04:24 AM
Hi @SB & @rushikeshvartak
can you guys help in how to pass the call1 response to call2. i have to pass sys_id of call1 response to call2 url
i have tried follow response paths but none of them are working
${response.call1.message.result.sys_id}
${response.call1.message.sys_id}
${call1.response.sys_id}
${call1.result.sys_id}
Any help would be greatly appreciated.
Thanks
Sampath
04/21/2023 08:37 AM
You need to use dependent call variable when the call2 is dependent on call1. You can refer to the below REST connector guide for JSON reference of the same (Common features -> Support for Multiple API Call).
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm
04/21/2023 08:49 AM
@SB I was exactly referring to same document. I have already included dependent call variable. Please check below JSON.
I have tried with binding Variables ${accountID) and ${accountName} but still no change in error. It still says Nullresponse from Target.
{
"accountParams":{
"connection":"userAuth",
"processingType":"SequentialAndIterative",
"call":{
"call1":{
"callOrder":0,
"stageNumber":0,
"http":{
"url":"https://dev.service-now.com/api/now/table/sys_user?user_name=56607&sysparm_fields=first_name,last_na...",
"httpMethod":"GET",
"httpParams":"{\"sysparm_display_value\":\"true\"}",
"httpHeaders":{
"Authorization":"Basic ######"
},
"httpContentType":"application/json"
},
"statusConfig":{
"active":"true",
"inactive":"false"
},
"listField":"result",
"keyField":"accountID",
"accountIdPath":"result.sys_id",
"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",
"http":{
"url":"https://dev.service-now.com/api/now/table/alm_hardware?sysparm_query=install_status%3D1%5Eassigned_t...}",
"httpMethod":"GET",
"httpParams":"{\"sysparm_display_value\":\"true\"}",
"httpHeaders":{
"Authorization":"Basic #########",
"Accept":"application/json"
},
"httpContentType":"application/json"
},
"inputParams": {
"dependentCall": true
},
"listField":"result",
"keyField":"accountID",
"nextApiKeyField":"accountID",
"colsToPropsMap":{
"accountID":"assigned_to.value~#~char",
"CUSTOMPROPERTY8":"asset_tag~#~char"
}
}
}
}
}
Thanks,
Sampath
04/21/2023 08:56 AM
Can you share the Call2 url value you are passing. In the above jsons the value is getting truncated. You can mask the domain name in url to shorten it. I basically need to check the url after sysparm_query.
Also, can you check in the logs for Calling Webservice Url to see if it is resolving the value for the DA used.
04/21/2023 09:08 AM
04/21/2023 09:14 AM
can you check in the logs for Calling Webservice Url for 2nd call to see if it is resolving the value for the DA used.
04/21/2023 09:15 AM - edited 04/21/2023 09:16 AM
04/21/2023 10:00 AM
Hi @SB
Thank you very much!! it is getting resolved. it seems issue was different. there were some invalid accounIDs hence it was throwing nulls reponse.
Thanks
Sampath
04/21/2023 10:16 AM
Can you confirm if you used ${account.accountID} or ${accountID} in the url of call2.
04/21/2023 10:19 AM
${account.accountID} is working. I think the document also needs correction.
Thanks once again.