Please share any images or screenshots, if relevant.
[Please insert images here, otherwise delete this section]
Can someone help me with the below filters/code, on below requirement.
I need to get the of list Identities or Links, who has Workday Link and on the company code is of or (a, b, c, e). Company Code attribute is there on the Workday Link level.
QueryOptions qo = new QueryOptions(); List andFilter= new ArrayList(); Filter.add(Filter.eq("application.name",<yourappName>)); Filter.like("companyCode", “a“, Filter.MatchMode.START); qo.addFilter(Filter.and(andFilter));
Do we need, make Workday Schema Attribute COMPANY_CODE as searchable? Then only will it Work. I have tried as, below and facing below error.
QueryOptions qo = new QueryOptions();
List andFilter= new ArrayList();
Filter.add(Filter.eq(“application.name”,“Workday”));
Filter.eq(“COMPANY_CODE”, “xcv”);
qo.addFilter(Filter.and(andFilter));
Iterator itx = context.search(Link.class, qo);
NOTE:COMPANY_CODE is WORKDAY application exact schema attribute
Exception running rule: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: ``import java.math.BigInteger; import java.lang.StringBuilder; import java.tex . . . ‘’ : Error in method invocation: Static method add(sailpoint.object.Filter$LeafFilter) not found in class’sailpoint.object.Filter’
QueryOptions qo = new QueryOptions();
List andFilter= new ArrayList();
Filter.add(Filter.eq(“application.name”,“Workday”));
Filter.eq(“COMPANY_CODE”,“0617”);
qo.addFilter(Filter.and(andFilter));
Iterator itx = context.search(Link.class,qo);
while (itx.hasNext()) {
Link link = (Link) itx.next();
log.error(“Found link: " + link.getNativeIdentity() +
" COMPANY_CODE=” + link.getAttribute(“COMPANY_CODE”));
}
When you create a Filter and do a search, your filter gets translated to a Hibernate query, which gets translated to SQL. In order for something to be searchable, you have to map it to a database column.
If Workday is an authoritative source, I would probably promote the attribute to an Identity attribute and search it on the Identity. If it is not, I’m not sure what I’d do. I’d prefer to avoid adding application-specific attributes to my database.
Can you share more about why you need specific company codes?
List<Identity> matchingIdentities = new ArrayList<>();
List<String> companyCodes = List.of("a", "b", "c", "e");
// Get all identities
List<Identity> allIdentities = context.getObjects(Identity.class);
for (Identity identity : allIdentities) {
// Get the links for the identity
List<Link> links = identity.getLinks();
for (Link link : links) {
// Check if the link is a Workday link
if (link instanceof WorkdayLink) {
WorkdayLink workdayLink = (WorkdayLink) link;
// Check if the company code matches
String companyCode = workdayLink.getCompanyCode();
if (companyCodes.contains(companyCode)) {
matchingIdentities.add(identity);
break; // No need to check other links for this identity
}
}
}
}
Thank You, rakesh. the code which you shared is working, but we need to load all identities and check the link. What we did is we have created Identity attribute for those and mapped the values from workday, then we were able to write the filter easily.