so i need to remove all assigned roles of identity upon termination so i added this step in termination workflow to remove assigned roles but it is showing in log all roles but not actually deleting it.. i tried both remove(role) and removeAssignedRole(role) but both seems to be not working
import org.apache.log4j.Logger;
import java.util.List;
Identity identity = context.getObjectByName(Identity.class, identityName);
if (identity == null) {
logger.error("Identity not found: " + identityName);
return;
}
List assignedRoles = identity.getAssignedRoles();
if (assignedRoles == null || assignedRoles.isEmpty()) {
logger.debug("No roles assigned to identity: " + identityName);
return;
}
logger.debug("Total roles to be removed: " + assignedRoles.size());
for (Bundle role : assignedRoles) {
logger.debug("Removing role: " + role.toString());
identity.remove(role);
}
context.saveObject(identity);
context.commitTransaction();
soo i need to make a script that deletes all roles of identity??? but isnât it the same thing that i am doing in the workflow? ⌠the main issue is while i am terminating identity, the roles still exist in it therefore every time the identity is refreshed it gets re assigned to its role
âidentity is refreshed it gets re assigned to its roleâ thatâs why we need to change the identity attribute so it will not match the role criteria.
In our case, we change the identity status to T so refresh will not assign the business roles again.
we are actually changing identity status and the roles like birthright provisioning is not actually getting re assigned .. the problem are only with the roles that are Request Based that are getting re assigned.
Do you have any assignment rule configured for those roles ? if those roles are marked as requestable then it should never gets assigned. also check if you have any sticky assignment for those identity. In leaver you need handle that also.
Hello @autorun6464 the assigned roles will be automatically removed upon termination. Customizations to the workflow are not required. However, if youâre using a custom termination process, you may add the necessary steps as neededâplease refer to this document for guidance.
Link: Terminating Identities with Rapid Setup
For Example:
Iâm terminating Betty; she has some assigned roles called BR Role 1, as shown in the image below.