How do I Filter a query against a Link extended attribute?

I have Active Directory links with an extended attribute called “distinguishedName”. The Link objects also have a non-extended attribute called “identity” that holds the same value.

For the life of me I cannot get a working QueryOption Filter configured to search against either of these so I must be missing something basic. I’ve tried every combination I can think of such as these. Please let me know what I’m missing here, I don’t know how to reference these attributes.


String dn = "...";
QueryOptions qo = new QueryOptions();

// None of these work
qo.add(Filter.eq("identity", dn));
qo.add(Filter.eq("attribute.identity", dn));
qo.add(Filter.eq("links.identity", dn));
qo.add(Filter.eq("links.attribute.identity", dn));
qo.add(Filter.eq("distinguishedName", dn));
qo.add(Filter.eq("links.distinguishedName", dn));
qo.add(Filter.eq("attribute.distinguishedName", dn));
qo.add(Filter.eq("links.attribute.distinguishedName", dn));
qo.add(Filter.eq("LinkExternalAttribute.identity", dn));
qo.add(Filter.eq("LinkExternalAttribute.distinguishedName", dn));

List<Link> links = context.getObjects(Link.class, qo);

Hi @jgruendike

Since you mentioned distinguishedName to be an extended attribute. Can you please check if the attribute is marked as Searchable?

I may be using the wrong terminology since when I looked at external attributes nothing popped up. However, here is an example of what I see when I look at an AD Link inside of an Identity object:

 <Link displayName="" id="" identity="[...]" uuid="">
      <ApplicationRef>
        <Reference class="sailpoint.object.Application" id="" name="AD"/>
      </ApplicationRef>
      <Attributes>
        <Map>
          <entry key="distinguishedName" value="[...]"/>

Is there something special that has to be done in order to create a Filter that would match either the identity value or distinguishedName attribute? As stated everything I’ve tried so far results in a “could not resolve property” error.

Hi @jgruendike ,

Can you try :

QueryOptions qo = new QueryOptions();
List andFilter= new ArrayList();
Filter.add(Filter.eq("application.name",appName));
Filter.like("identity", "CN=" + wantedCN, Filter.MatchMode.START);
qo.addFilter(Filter.and(andFilter));

Iterator itx = context.search(Link.class, qo);

Hi @jgruendike

As mentioned by @dheerajk27 you can try the above solution.
If that doesn’t work, instead of passing “identity” in the Filter pass “nativeIdentity”

1 Like

Thank you! You’re a life saver … I got it to work the way I need with this code based on your example and Dheeraj’s suggestion.

        QueryOptions qo = new QueryOptions();
        List<Filter> andFilter= new ArrayList<Filter>();
        andFilter.add(Filter.eq("application.name", "ADName"));
        andFilter.add(Filter.like("nativeIdentity", "CN=..., Filter.MatchMode.START));
        qo.addFilter(Filter.and(andFilter));
        
        Iterator<Link> itx = context.search(Link.class, qo);
1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.