@MamtaLnu Welcome to the SailPoint Developer Community
For 1 : pls check in this link has solution : Get Account Schema in before provisioning Rule - Identity Security Cloud (ISC) / ISC Discussion and Questions - SailPoint Developer Community
For 2: If role has one type of entitlement then you can use source ID
String sourceId = application.getId();
ManagedAttributeDetails managedAttrDetails = idn.getManagedAttributeDetails( sourceId, type, entIdValue, null );
if (null != managedAttrDetails)
{
Map managedAttributesMap = managedAttrDetails.getAttributes();
if (!managedAttributesMap.isEmpty())
{
entName = managedAttributesMap.get("name");
}
}
Let me know if this works.