I am calling all Roles in a field. I need those rules to be of type SAP. What should I do to get only SAP type roles?
<Field displayName="Roles" multi="true" name="Field_7" postBack="true" required="true" type="Bundle"/>
I am calling all Roles in a field. I need those rules to be of type SAP. What should I do to get only SAP type roles?
<Field displayName="Roles" multi="true" name="Field_7" postBack="true" required="true" type="Bundle"/>
Hi @pctripathi,
Do you have a Role attribute called type in Role configuration? if yes, you can use below code to get only SAP type roles in the dropdown.
<Field displayName="Roles" multi="true" name="Field_7" postBack="true" required="true" type="Bundle">
<AllowedValuesDefinition>
<Script>
<Source>
import sailpoint.tools.Util;
import sailpoint.object.Bundle;
import sailpoint.object.QueryOptions;
import sailpoint.object.Filter;
List roleList= new ArrayList();
QueryOptions ops=new QueryOptions();
ops.addFilter(Filter.eq("type","SAP"));
Iterator it = context.search(Bundle.class, ops);
while ( (null != it) && (it.hasNext()) ) {
Bundle record = (Bundle)it.next();
roleList.add(record.getName()) ;
}
return roleList;
</Source>
</Script>
</AllowedValuesDefinition>
</Field>
Regards,
Arun
Hi @Arun-Kumar
It filtered and showed the results with role type SAP but it is also showing roles which has no type defined and is blank.
Add one more filter like below and try
ops.addFilter(Filter.notnull("type"));
Added this line below the filter. It’s still same.
Hi @pctripathi,
Are all roles displayed in the dropdown, or only those with a SAP type and a blank type?
“type” attribute defined in Role Configuration?
Regards,
Arun
@pctripathi
Just use this and check
<Field displayName="Roles" multi="true" name="Field_7" postBack="true" filterString="type == "SAP"" required="true" type="Bundle"/>
Hi @Arun-Kumar
only those with a SAP type and a blank type
Yes type attribute is defined.
Hi @iamksatish
I tried, its showing no results in th field.
Share a sample SAP Role xml once