How to get the Manager of the Identity

There are so many cases when we need to fetch the manager of an Identity. Here we will see how we can get the manager of an Identity.

getManager() is the method to get the manager of an Identity. getManager() method is applied to the identity of which we want to fetch the manager detail. getManager() will return the identity object.

 

Identity id=context.getObjectByName(Identity.class,"Alen cooper");

//this will fetch the manager of Alen cooper identity
Identity manager = id.getManager();

return manager.getName();