Entitlement from account endpoint

My response of the edpoint

“items”:[
{
“Role”:{
“id”:“A”,
“name”:“a”
},
“team”:{
“id”:2
“name”:“b”
}
}
…
]
}

in order to fetch this data im using rule:

import connector.common.JsonUtil;
import sailpoint.tools.Util;

log.error("Starting Web Service Aggregation Rule");

List<Map<String, Object>> identities = new ArrayList<>();

// Check if the response contains data
if (rawResponseObject != null && !rawResponseObject.isEmpty()) {
    // Parse the raw JSON response into a Map
    Map<String, Object> responseMap = JsonUtil.toMap(rawResponseObject);

    // Check if "items" exists in the response
    if (responseMap != null && responseMap.containsKey("items")) {
        List<Map<String, Object>> items = (List<Map<String, Object>>) responseMap.get("items");

        // Loop through each item in the "items" array
        for (Map<String, Object> item : items) {
            // Extract "Role" and "team" details
            Map<String, Object> role = (Map<String, Object>) item.get("Role");
            Map<String, Object> team = (Map<String, Object>) item.get("team");

            if (role != null && team != null) {
                // Create an identity record
                Map<String, Object> identity = new HashMap<>();
                identity.put("roleId", role.get("id"));
                identity.put("roleName", role.get("name"));
                identity.put("teamId", team.get("id"));
                identity.put("teamName", team.get("name"));

                // Add the identity record to the list
                identities.add(identity);
            }
        }
    } else {
        log.error("'items' not found in the response");
    }
} else {
    log.error("Raw response object is null or empty");
}

// Log the aggregated identities for debugging
log.error("Aggregated Identities: " + identities);

// Return the aggregated data
return identities;

image

Can you try the below code and LMK if it works.

import connector.common.JsonUtil;
import sailpoint.tools.Util;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

    List identities = new ArrayList();

    // Check if the response contains data
    if (rawResponseObject != null && !rawResponseObject.isEmpty()) {
        // Parse the raw JSON response into a Map
        Map responseMap = JsonUtil.toMap(rawResponseObject);

        // Check if "items" exists in the response
        if (responseMap != null && responseMap.containsKey("items")) {
            List items = (List) responseMap.get("items");

            // Loop through each item in the "items" array
            for (Map item : items) {
                // Extract "Role" and "team" details
                Map role = (Map) item.get("Role");
                Map team = (Map) item.get("team");

                if (role instanceof Map && team instanceof Map) {
                    // Create an identity record
                    Map identity = new HashMap();
                    identity.put("roleId", role.get("id"));
                    identity.put("roleName", role.get("name"));
                    identity.put("teamId", team.get("id"));
                    identity.put("teamName", team.get("name"));

                    // Add the identity record to the list
                    identities.add(identity);
                }
            }
        } else {
            log.error("'items' not found in the response");
        }
    } else {
        log.error("Raw response object is null or empty");
    }

    // Log the aggregated identities for debugging
    log.info("Aggregated Identities: " + identities);

    // Return the aggregated data
    return identities;
}

Hi ,
Resolved this. Created a new attribute named “roles-teams” in the entitlement schema and marked it as entiId and EntName. This atttribte will have the values in the format of RolesId :teamsId .So, the name contains both the roleid and teamsId. During provisoning , It will be split and sent in the provsioning plan

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.