The engineer uses the sailpoint.api.IdentityService in a BeanShell method to look up and return all account names for an identity on the application ' MagicBox ' . Is this a correct implementation?
Proposed Solution:
import sailpoint.api.IdentityService;
import sailpoint.api.SailPointContext;
import sailpoint.object.Identity;
import sailpoint.object.Link;
import sailpoint.tools.GeneralException;
public List getAccountNames(SailPointContext context, Identity identity) throws GeneralException {
IdentityService service = new IdentityService(context);
List < String > accountNames = new ArrayList < String > ();
Link link = service.getLink(identity, " MagicBox " );
while (link != null) {
accountNames.add(link.getNativeIdentity());
}
return accountNames;
}
Submit