and more in a single search tool across platforms. Read the announcement here. |
01/13/2023 03:52 AM
In GET API call for entitlements we are getting entitlement owner's (support owner and development owner) and environment(QA/STAGE/PROD etc..) information with other details. Based on the environment we wanted to choose one of the owners inside entOwnerMappings. for ex if environment=='PROD' then map support owner as entitlement owner else use development owner.
Sample API response
{
"result": [
{
"id": "id1"
"name": "xyz",
"environment": "PROD",
"development_owner.user_name": "username",
"support_owner.user_name": "username"
}
]
}
01/13/2023 04:55 AM - edited 01/13/2023 04:56 AM
You can use #const followed by your logic
01/13/2023 08:24 AM
tried this inside entOwnerMappings but didnt work
"idPath": "#CONST#${if(environment~dot#name=='DEV') {return \"development_owner~dot#user_name\"} else {return \"support_owner~dot#user_name\"}}"
entilement import job is in success state, not giving any error / exception as well
01/16/2023 01:27 AM
tried ternary operator as well but no luck
"idPath": "${environment~dot#name == \"DEV\" ? \"development_owner~dot#user_name\" : environment~dot#name == \"PROD\" ? \"support_owner~dot#user_name\" : \"xyz\"}",
@rushikeshvartak any other suggestion you have to try out?
01/17/2023 02:16 PM
Can you try this
"idPath": "environment.equalsIgnoreCase('PROD')?support_owner.user_name:development_owner.user_name"
01/17/2023 08:12 PM
You need to use #CONST also
01/17/2023 10:10 PM
Thanks @sk and @rushikeshvartak for your revert. i have tried both the suggestions with different permutation combination but no luck. Here are the details i tried out for your reference:
Sample API response
{
"result": [
{
"id": "id1"
"name": "xyz",
"u_legacy_id": "1",
"sys_class_name": "Test",
"u_environment.name": "PROD",
"u_development_owner.user_name": "username",
"u_support_owner.user_name": "username"
}
]
}
1) "idPath": "u_environment~dot#name.equalsIgnoreCase('PROD')?u_support_owner~dot#user_name:u_development_owner~dot#user_name",
2) "idPath": "#CONST#${u_environment~dot#name.equalsIgnoreCase('PROD')?u_support_owner~dot#user_name:u_development_owner~dot#user_name}",
3) "idPath": "u_environment.name.equalsIgnoreCase('PROD')?u_support_owner.user_name:u_development_owner.user_name",
Few observations:
1) inside colsToPropsMap in entitlementParams, i tried to concatenate two parameters sys_class_name and legacy id which worked fine using this format
"customproperty30": "#CONST#${return response.sys_class_name+ \" \" + response.u_legacy_id}~#~char",
but if i try same thing for attributes where we have dot (which i replaced with ~dot#) in attribute name it doesnt work. for ex
"customproperty30": "#CONST#${return response.u_development_owner~dot#user_name+ \" \" + response.u_development_owner~dot#user_name}~#~char",
2) i think i am sure we can't use if-else condition or ternary operator in colsToPropsMap because i tried it with above working example like this
"customproperty30": "#CONST#${String dev1 = response.sys_class_name; String sup1 = response.u_legacy_id; if (sup1 == '1'){ret = dev1} else(ret = dev1 + \" \" + sup1) return ret}~#~char",
3) i somehow believe that the problem is with dot in attribute name. so any idea how to tackle it (tried replacing it with ~dot# as per FD but no luck)
Any suggestions or follow up questions would help to take this problem towards resolution. thanks
01/18/2023 04:34 AM
No it should not be issue with dot
if you think dot issue then
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:41 AM
Hi @rushikeshvartak - from above given examples, can you share one example with your changes to try. because i have tried many combinations with (.) and without dot (using ~dot#) but it doenst work. or refer following options i have tried so far
"idPath": "u_environment~dot#name.equalsIgnoreCase('PROD')?u_support_owner~dot#user_name:u_development_owner~dot#user_name",
"idPath": "#CONST#${u_environment~dot#name.equalsIgnoreCase('PROD')?u_support_owner~dot#user_name:u_development_owner~dot#user_name}",
"idPath": "u_environment.name.equalsIgnoreCase('PROD')?u_support_owner.user_name:u_development_owner.user_name",
"idPath": "#CONST#${response.u_environment~dot#name.equalsIgnoreCase('PROD')?response.u_support_owner~dot#user_name:response.u_development_owner~dot#user_name}",
"idPath": "#CONST#${String en1 = response.u_environment~dot#name; String devow1 = response.u_development_owner~dot#user_name; String supow1 = response.u_support_owner~dot#user_name; en1.equalsIgnoreCase('PROD')?supow1:devow1}",
"idPath": "response.u_environment.name.equalsIgnoreCase('PROD')?response.u_support_owner.user_name:response.u_development_owner.user_name",
"idPath": "${if(u_environment~dot#name=='DEV') {return \"u_development_owner~dot#user_name\"} else {return \"u_support_owner~dot#user_name\"}}",
"idPath": "${if(\"u_environment~dot#name\"=='DEV') {return \"u_development_owner~dot#user_name\"} else {return \"u_support_owner~dot#user_name\"}}",
"idPath": "${if(\"u_environment.name\"=='DEV') {return \"u_development_owner~dot#user_name\"} else {return \"u_support_owner~dot#user_name\"}}",
"idPath": "#CONST#${if(u_environment~dot#name=='DEV') {return \"u_development_owner~dot#user_name\"} else {return \"u_support_owner~dot#user_name\"}}",
"idPath": "#CONST#${if(\"u_environment~dot#name\"=='DEV') {return \"u_development_owner~dot#user_name\"} else {return \"u_support_owner~dot#user_name\"}}",
"idPath": "#CONST#${if(\"u_environment.name\"=='DEV') {return \"u_development_owner~dot#user_name\"} else {return \"u_support_owner~dot#user_name\"}}",
"idPath": "${u_environment~dot#name == \"DEV\" ? \"u_development_owner~dot#user_name\" : u_environment~dot#name == \"PROD\" ? \"u_support_owner~dot#user_name\" : \"xyz\"}",
"idPath": "#CONST#${\"u_environment~dot#name\" == \"DEV\" ? \"u_development_owner~dot#user_name\" : \"u_environment~dot#name\" == \"PROD\" ? \"u_support_owner~dot#user_name\" : \"gaujain\"}",
"idPath": "#CONST#${\"u_environment.name\" == \"DEV\" ? \"u_development_owner~dot#user_name\" : \"u_environment.name\" == \"PROD\" ? \"u_support_owner~dot#user_name\" : \"gaujain\"}",
"idPath": "#CONST#${String en1 = response.u_environment~dot#name; String devow1 = response.u_development_owner~dot#user_name; String supow1 = response.u_support_owner~dot#user_name; if (en1 == \"DEV\") {retrun devow1} else {return supow1}}",
01/23/2023 04:52 PM
Try to store value in customproperty
01/23/2023 09:45 PM
Yes @rushikeshvartak , i have done that already but just looking at a work around if possible. thanks
01/23/2023 10:12 PM
Hi @rushikeshvartak not sure if i understood your response properly, hence writing again. Are you asking to store in customproperty and then use it inside idPath? if yes, then please share syntax to try. thanks
02/17/2023 06:09 AM
what is working syntax there
02/17/2023 06:50 AM
Hi @rushikeshvartak for my usecase i had to split one entitlement into two (prod and non-prod) because if-else condition doesnt work in idPath configuration. So, working solution for my api response is
"idPath": "u_development_owner~dot#user_name"
@Sivagami FYI
02/13/2023 12:34 PM
@GauravJain - I ran into a similar issue and found that string operation is not supported in idpath
Logged an enhancement request in idea's portal - https://ideas.saviynt.com/ideas/EIC-I-3803. Vote the idea to get traction from Saviynt team.
-Siva
02/17/2023 03:53 AM
Hi @Sivagami
i could be wrong here in my interpretation of your use case but what i observed in your solution is - you are mentioing entitlement value in idPath which is incorrect. idPath should only contain json path (similar to listPath in your example) which gives entitlement value. in your case there are two different paths 1) response.name 2) response.resource.
so, your idea is partially related to my problem where i am not able to decide a path based on some condition. in your case, you wanted to merge two different paths because entitlement value is spread across two paths 1) response.name 2) response.resource.
if above explanation looks reasonable then you will have to log another idea for this problem.
Please revert with your understanding on this.