Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/03/2024 02:45 PM
There is a sample json below. I would like to configure the ImportAccntEntJson for the REST connector so that, name and accountId holds the value of player id and customproperty1 will be true, if the player completes any of the training, otherwise, set to false. For the json below, customproperty1 for player 1 should be true and player 2 should be false.
{
"players":[
{
"id": 1,
"training": [
{
"trainingId": 1,
"status": "Completed"
},
{
"trainingId": 2,
"status": "Not Completed"
}
]
},
{
"id": 2,
"training": [
{
"trainingId": 1,
"status": "Not Completed"
},
{
"trainingId": 2,
"status": "Not Completed"
}
]
}
]
}
.How to do that? I am not sure how to iterate over the content and do the logical calculations and return true or false. Any help would be greatly appreciated.
Solved! Go to Solution.
08/03/2024 04:02 PM
You can use #CONST and iterate through response from api
08/03/2024 04:07 PM
How do I access the "training" array inside const?
08/04/2024 03:17 AM
Change as per your needs
def result = call1.response.players.collect { p -> ["name": p.id.toString(), "accountId": p.id.toString(), "customproperty1": p.training.any { it.status == "Completed" } ? "true" : "false"] }; return result
08/08/2024 08:49 AM
After some trial and error, and revision, I have the following json config working.
ImportAccountEntJSON
{
"accountParams": {
...
...
"listField": "players",
...
...
"colsToPropsMap": {
"name": "id~#~char",
"accountID": "id~#~char",
"customproperty1": "#CONST#${response.training.any{map->map.status=='Completed'}}~#~char"
}
...
...
}
}