How to get the assigned roles of an Identity in SailPoint?

In this SailPoint code series, we will see how to get the roles any identity have in SailPoint IIQ. getAssignedRoles is the method in SailPoint IIQ which is used to get all the assigned role to any identity.

getAssignedRoles() method is applied on identity on which we have to find the roles. General syntax is

 

identity.getAssignedRoles();

It will return the list of bundle.

  import java.lang.*;
  import java.util.*;
  import sailpoint.object.*;

  Identity iden = (Identity) context.getObjectByName(Identity.class,"Mary.Johnson"); 

  List bundle= iden.getAssignedRoles();
  return bundle;