How to get attribute value of an identity in Sailpoint

In this Sailpoint tutorial example post, we will see how to get any attribute value of an Identity in SailPoint.

In Identity object, Sailpoint has getAttribute api method which is used to get the attribute of an identity.

import java.util.Map;
import java.util.HashMap;
import sailpoint.api.SailPointContext;
import sailpoint.object.Identity;

Map idenAttributeMap=new HashMap();
Identity iden=context.getObjectByName(Identity.class,"12345");

//print all attributes of an identity.
//return iden.toXml();

//get the phonenumber
return iden.getAttribute("phonenumber");

//get firstName
//return iden.getAttribute("firstName");

In sailPoint, Any identity attribute value can be get through getAttribute method.