and more in a single search tool across platforms. Read the announcement here. |
06/28/2022 08:17 PM
Can we use string function in ImportAccountEntJSON in colsToProp configuration ?
Requirement :
We have entitlement which name is combination of 2 values from API
- user + readonly
- user + no access
Can we use string functions such as concat, replace?
If no then any workaround from saviynt side
Solved! Go to Solution.
06/29/2022 04:31 AM
@rushikeshvartak I am also facing the same requirement where I need to use string functions in colsToProp configuration. Did you find any solution?
06/29/2022 04:53 AM
Hello,
You can use the CONST function available and see if you can specify your manipulation there.
Example :
"responseColsToPropsMap": { "name": "#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.substring(1, acctId.length()-1); return acctId}~#~char", "accounttype": "#CONST#Internal~#~char" }
06/29/2022 05:26 AM
@sahajranajee Thanks for the response. Can this be used in "ImportAccountEntJSON" in "colsToPropsMap" configuration? All the references for CONST function I found are related to provisioning JSONs.
06/29/2022 05:56 AM
@sahajranajee @rushikeshvartak I was able to use the #CONST function successfully in "ImportAccountEntJSON" in "colsToPropsMap" configuration to concatenate string values from API response.
"customproperty7": "#CONST#${String op = response.operation.operation; String target = response.operation.targetType; ret = op + \" \" + target; return ret}~#~char"
In above example response contains data from "listField".
06/29/2022 09:35 AM
response.operation.operation is target application JSON mapping ?or same irrespective of application
06/29/2022 09:42 AM
@rushikeshvartak Following is my API response -
{
"results": [
{
"key": "~565117918",
"name": "Test Space 1",
"permissions": [
{
"id": 249135157,
"subjects": {
"group": {
"results": [
{
"type": "group",
"name": "site-admins",
"id": "a7f6277b-c40b-4cbf-bcbc-51925e91a7c9"
}
]
}
},
"operation": {
"operation": "administer",
"targetType": "space"
}
},
{
"id": 249135164,
"subjects": {
"group": {
"results": [
{
"type": "group",
"name": "site-admins",
"id": "a7f6277b-c40b-4cbf-bcbc-51925e91a7c9"
}
]
}
},
"operation": {
"operation": "delete",
"targetType": "page"
}
}
]
}
]
}
And this is how I used the CONST function with string concatenation -
"SpacePermission": {
"entTypeOrder": 4,
"call": {
"call1": {
"callOrder": 2,
"stageNumber": 3,
"inputParams": {
"entitlementname": "Space"
},
"http": {
"url": "https://#####/api/space?spaceKey=${entitlementID}&expand=permissions",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpMethod": "GET"
},
"listField": "results[0].permissions",
"keyField": "entitlementID",
"colsToPropsMap": {
"entitlementID": "id~#~char",
"entitlement_value": "#CONST#${String op = response.operation.operation; String target = response.operation.targetType; ret = op + \"-\" + target; return ret}~#~char"
}
}
}
}
06/29/2022 10:58 AM - edited 06/29/2022 11:33 AM
it worked 🙂
Concat Logic :
"customproperty7": "#CONST#${String data1 = response.operation.operation; String data2 = response.operation.targetType; ret = data1 + \" \" + data2; return ret}~#~char"
Here response. will be hardcoded variable
operation.operation is path for variable in colsToProps
Note : Don't add listField Path
01/17/2023 10:14 PM
We can also directly reference the values from Json like this
"customproperty30": "#CONST#${return response.operation.operation+ \" \" + response.operation.operation}~#~char",
01/17/2023 10:15 PM
Question is what if we have dot in attribute name. For example attribute name is "operation.operation" then how do we use it. tried with response.operation~dot#operation but didnt work.
01/18/2023 04:33 AM
Resolution: To resolve this issue, specify the field name with the separator ~dot#. For example, replace manager.user_name with manager~dot#user_name
01/20/2023 03:35 AM
Hi @rushikeshvartak - i have tried that already and it didn't work , hence posted it on this chain.
Also, are you asking to try "manager~dot#user_name" or "response.manager~dot#user_name". i have tried the later one and it didnt work.
02/06/2023 01:29 AM
Can we also use this approach to in the Entitlement_ID & Entitlement_Value field?
I am trying to use the below mapping but instead a entitlement is getting created with the value with CONST
"colsToPropsMap":{
"entitlementID":"#CONST#${String data1 = response.role.id; String data2 = response.product.id; ret = data1 + \"-\" + data2; return ret}~#~char",
"entitlement_value":"#CONST#${String data1 = response.role.name; String data2 = response.product.name; ret = data1 + \"-\" + data2; return ret}~#~char"
}
02/06/2023 05:49 PM
It should work
02/06/2023 09:02 PM
It is not working.
The API looks like this :
In the JSON i have :
"listField":"items",
"keyField":"entitlementID",
"colsToPropsMap":{
"entitlementID":"#CONST#${String data1 = response.role.id; String data2 = response.product.id; ret = data1 + \"-\" + data2; return ret}~#~char",
"entitlement_value":"#CONST#${String data1 = response.role.name; String data2 = response.product.name; ret = data1 + \"-\" + data2; return ret}~#~char"
}
02/06/2023 10:13 PM
Hi @prachi
try using "items.product.id" and "items.role.id" and similary for entitlement_value as well.
it should work.