Best way to get an application account attribute

Hi all,

What is the best way to get an application account attribute when the identity object is available?

  1. getLinks(). Then iterate over the list
  2. Filter
  3. Any other way, please suggest

Thanks in advance

Hi @rishavghoshacc

PLease refer this blog that I have written to get the application attributes.

How to Retrieve Link Attributes of a User by Application Name in SailPoint - IdentityIQ (IIQ) / IIQ Community Knowledge Base - SailPoint Developer Community

4 Likes

Filter is one of the best ways to retrieve the account attributes.

3 Likes

If identity object is available then go for first one. If identity object is not available then go for second option.

I would use the sailpoint.api.IdentityService class to get the Link(s) for the identity for the specified application and pull the attributes off the Link object

I also believe this should be your approach.

1 Like

We can use methods from sailpoint.api.IdentityService class.

This class contains multiple methods like getLinks(), getLink(), etc. with different arguments.

Suitable method can be used as per requirement.

4 Likes

Best sutable method is use .getlink(), if you know the specific application and attribute. Instead you need all applications of user then use .getlinks() method.

1 Like

Hello @rishavghoshacc

In IdentityIQ, application account attributes are stored on the Link,
So the best way is to fetch the required Link (preferably using IdentityService.getLink() when you know the application) and then read the attribute from that Link.

Hi @rishavghoshacc you can use following code to get the application links and link attributes:

IdentityService idService = new IdentityService(context);
Identity id = context.getObjectByName(Identity.class, "identity_name");
Application app = context.getObjectByName(Application.class, "application_name_name");
//this will return list of all accounts identity has on this particular application.
List links = getLinks​(id,app);
//iterate over links
for (Link link : links) {
link.getAttribute("attribute_name");
}

List links = idService.getLinks​(id,app);

If you have multiple links on the application, you might want to add necessary condition to get the attribute from desired link only.

1 Like

Hi @rishavghoshacc

If the Identity object is already available, the correct and recommended way to retrieve an application account attribute is through the Link object.

In IdentityIQ, application account attributes are not stored on the Identity. They are stored on the account (Link) connected to the Identity.

Identity → Link (account) → Account attributes

Conclusion:
The authoritative place to read any application account attribute in IdentityIQ is the Link object. Accessing the Link directly using identity.getLink("ApplicationName") is the preferred and most efficient approach.

Hope this is helpful

Note: Found a fix? Help the community by marking the comment as solution. Feel free to react(:heart:, :+1:, etc.) with an emoji to show your appreciation or message me directly if your problem requires a deeper dive