Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/18/2024 09:19 AM
Hi ,
I am using the below if else syntax in REST connector JSOn. even though the task are getting completed but the correct values in condition are not getting picked up.
Can anyone validate if i am doing it the right way or not ?
{
"call": [
{
"name": "Country",
"connection": "acctAuth",
"url": "https://xyz/Users/${account.customproperty5}",
"httpMethod": "PATCH",
"httpParams": "{\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\":[{\"op\": \"add\",\"path\":\"urn:ietf:params:scim:schemas:extension:spend:2.0:Role:roles\",\"value\":[{\"roleName\":\"${requestAccessAttributes?.get('Rolename')}\",\"roleGroups\":[\"if(${${task.entitlement_valueKey.entitlement_value}}=='AUSTRIA') {'[AT-480]'} else if(${task.entitlement_valueKey.entitlement_value}=='Belgium'){'[BE-140]'} else if(${task.entitlement_valueKey.entitlement_value}=='Canada'){'[CA-002]'} else if(${task.entitlement_valueKey.entitlement_value}=='Denmark'){'[DK-200]'} else if(${task.entitlement_valueKey.entitlement_value}=='Finland'){'[FI-230]'} else if(${task.entitlement_valueKey.entitlement_value}=='France'){'[FR-130]'} else if(${task.entitlement_valueKey.entitlement_value}=='Germany'){'[DE-060]'} else if(${task.entitlement_valueKey.entitlement_value}=='Greece'){'[GR-270]'} else if(${task.entitlement_valueKey.entitlement_value}=='Ireland'){'[IE-120]'} else if(${task.entitlement_valueKey.entitlement_value}=='Italy'){'[IT-150]'} else if(${task.entitlement_valueKey.entitlement_value}=='Mexico'){'[MX-170]'} else if(${task.entitlement_valueKey.entitlement_value}=='NL-Venray'){'[NL-070]'} else if(${task.entitlement_valueKey.entitlement_value}=='NL-Holland'){'[NL-071]'} else if(${task.entitlement_valueKey.entitlement_value}=='Norway'){'[NO-080]'} else if(${task.entitlement_valueKey.entitlement_value}=='Portugal'){'[PT-050]'} else if(${task.entitlement_valueKey.entitlement_value}=='Spain'){'[ES-040]'} else if(${task.entitlement_valueKey.entitlement_value}=='Sweden'){'[SE-090]'} else if(${task.entitlement_valueKey.entitlement_value}=='Switzerland'){'[CH-470]'} else if(${task.entitlement_valueKey.entitlement_value}=='United Kingdom'){'[UK-010]'} else if(${task.entitlement_valueKey.entitlement_value}=='US-XBS'){'[US-005]'} else if(${task.entitlement_valueKey.entitlement_value}=='Isreal'){'[IL-310]'} else if(${task.entitlement_valueKey.entitlement_value}=='Malaysia'){'[MY-320]'} else if(${task.entitlement_valueKey.entitlement_value}=='Japan'){'[JP-100]'} else if(${task.entitlement_valueKey.entitlement_value}=='S korea'){'[KR-530]'} else if(${task.entitlement_valueKey.entitlement_value}=='China'){'[CN-340]'} else if(${task.entitlement_valueKey.entitlement_value}=='Hong kong'){'[HK-370]'} \"]}]}]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}
Solved! Go to Solution.
06/18/2024 10:05 AM
Hi @Rajatlm10 ,
The "IF / ELSE" condition must be surrounded by ${ } and all the logic must be contained inside, but you then don't need to use the same to surround the task.entitlement_value.entitlement_value object.
Please find an example below (simplified) :
${if (task.entitlement_valuekey.entitlement_value=='AUSTRIA') {'[AT-480]'} else if if(task.entitlement_valueKey.entitlement_value=='Belgium'){'[BE-140]'} else if () {} ... else {''} }
Hope this helps.
06/18/2024 10:51 AM
{ "call": [ { "name": "Country", "connection": "acctAuth", "url": "https://xyz/Users/${account.customproperty5}", "httpMethod": "PATCH", "httpParams": "{\"schemas\":[\"urn:ietf:params:scim:api:messages:2.0:PatchOp\"],\"Operations\":[{\"op\": \"add\",\"path\":\"urn:ietf:params:scim:schemas:extension:spend:2.0:Role:roles\",\"value\":[{\"roleName\":\"${requestAccessAttributes?.get('Rolename')}\",\"roleGroups\":[\"${if (task.entitlement_valueKey.entitlement_value == 'AUSTRIA') {'[AT-480]'} else if (task.entitlement_valueKey.entitlement_value == 'Belgium') {'[BE-140]'} else if (task.entitlement_valueKey.entitlement_value == 'Canada') {'[CA-002]'} else if (task.entitlement_valueKey.entitlement_value == 'Denmark') {'[DK-200]'} else if (task.entitlement_valueKey.entitlement_value == 'Finland') {'[FI-230]'} else if (task.entitlement_valueKey.entitlement_value == 'France') {'[FR-130]'} else if (task.entitlement_valueKey.entitlement_value == 'Germany') {'[DE-060]'} else if (task.entitlement_valueKey.entitlement_value == 'Greece') {'[GR-270]'} else if (task.entitlement_valueKey.entitlement_value == 'Ireland') {'[IE-120]'} else if (task.entitlement_valueKey.entitlement_value == 'Italy') {'[IT-150]'} else if (task.entitlement_valueKey.entitlement_value == 'Mexico') {'[MX-170]'} else if (task.entitlement_valueKey.entitlement_value == 'NL-Venray') {'[NL-070]'} else if (task.entitlement_valueKey.entitlement_value == 'NL-Holland') {'[NL-071]'} else if (task.entitlement_valueKey.entitlement_value == 'Norway') {'[NO-080]'} else if (task.entitlement_valueKey.entitlement_value == 'Portugal') {'[PT-050]'} else if (task.entitlement_valueKey.entitlement_value == 'Spain') {'[ES-040]'} else if (task.entitlement_valueKey.entitlement_value == 'Sweden') {'[SE-090]'} else if (task.entitlement_valueKey.entitlement_value == 'Switzerland') {'[CH-470]'} else if (task.entitlement_valueKey.entitlement_value == 'United Kingdom') {'[UK-010]'} else if (task.entitlement_valueKey.entitlement_value == 'US-XBS') {'[US-005]'} else if (task.entitlement_valueKey.entitlement_value == 'Isreal') {'[IL-310]'} else if (task.entitlement_valueKey.entitlement_value == 'Malaysia') {'[MY-320]'} else if (task.entitlement_valueKey.entitlement_value == 'Japan') {'[JP-100]'} else if (task.entitlement_valueKey.entitlement_value == 'S korea') {'[KR-530]'} else if (task.entitlement_valueKey.entitlement_value == 'China') {'[CN-340]'} else if (task.entitlement_valueKey.entitlement_value == 'Hong kong') {'[HK-370]'} else {''}}]\"]}]}]}", "httpHeaders": { "Authorization": "${access_token}", "Accept": "application/json" }, "httpContentType": "application/json", "successResponses": { "statusCode": [ 200, 201 ] } } ] } |
07/15/2024 07:04 AM
07/15/2024 07:06 AM
Share logs
07/15/2024 07:36 AM
How can I share them securely?
07/15/2024 07:37 AM
‼️‼️⚠️Keep company-specific private information masked on public forums, such as the name and URL.⚠️‼️‼️
07/15/2024 07:37 AM
You need to anonymise data to not contain any information from customer.
07/15/2024 07:42 AM