How to Retrieve Link Attributes of a User by Application Name in SailPoint

Problem

How to Retrieve Link Attributes of a User by Application Name in SailPoint

Diagnosis

Introduction

In SailPoint IdentityIQ and IdentityNow (ISC), identities rarely exist in isolation. Each user is connected to multiple target systems such as Active Directory, HR platforms, databases, and cloud applications. These connections are represented as links, and each link contains application-specific data known as link attributes.

In real-world IAM implementations, a common requirement is:

Given a user and an application name, how do we retrieve the correct account attributes from that application?

This requirement frequently appears during rule development, workflow customization, reporting, provisioning logic, and troubleshooting. Understanding how to retrieve link attributes accurately helps ensure your SailPoint implementation remains reliable, scalable, and easy to maintain.

Solution

/***
	 * This Method is used to fetch the link attributes of a particular Application and a user.
	 * @param userId
	 * @param appName
	 * @return
	 */
	public Map<Object, Object> getLinkAttributeMap(String userId, String appName) {
		Map linkAttr = new HashMap<Object, Object>();
		
		if(Util.isNotNullOrEmpty(userId) && Util.isNotNullOrEmpty(appName)) {
			try {
				Filter filter = Filter.and(Filter.eq("application.name", appName), Filter.eq("identity.name", userId));
				QueryOptions queryOptions = new QueryOptions();
				
				queryOptions.addFilter(filter);
				Attributes attrs = null;
				
				Iterator<Object[]> iteratorSearch = context.search(Link.class, queryOptions, "attributes");
				
				if(null != iteratorSearch) {
					if(iteratorSearch.hasNext()) {
						attrs = (Attributes) iteratorSearch.next()[0];
					}
					
					if(null != attrs) {
						linkAttr = attrs;	
					}
					
					Util.flushIterator(iteratorSearch);
				}
				
			}catch(Exception exp) {
				System.out.println("Exception occurred while fecthing link Attributes:- " + exp.getMessage());
			}
		}
		return linkAttr;
	}
4 Likes