Thursday, November 16, 2023

IdentityIQ Sailpoint Show only Active Manager in Workitem forwarding


            <entry key="ReassignmentRecipient">
              <value>
                <IdentityFilter name="ReassignmentRecipient" order="Ascending">
                  <FilterScript>
                    <Script>
                      <Source>
                        import sailpoint.object.Identity;
                        import sailpoint.object.QueryOptions;
                        import sailpoint.object.Filter;
                        import java.util.List;
                        import java.util.ArrayList;

                        Identity identity = context.getObjectById(Identity.class, loggedInUser);
                        if(identity == null){
                          identity = context.getObjectByName(Identity.class, loggedInUser);
                        }
                        QueryOptions qo = new QueryOptions();
                        List managers = new ArrayList();
                        int managerLevels = 2;
                        int maxIterations = 15;
                        if(identity != null){
                          int level = 0;
                          int iter = 0;
                          while((level &lt; managerLevels) &amp;&amp; (iter &lt; maxIterations)){
                             iter++;
                             Identity manager = identity.getManager();
                             if(null == manager)
                               break;
                             if(!manager.isInactive()){
                               managers.add(manager.getId());
                               level++;
                             }
                             identity = manager;
                          }
                        }
                        qo.addFilter(Filter.in("id",managers));
                        return qo;
                        </Source>
                    </Script>
                  </FilterScript>
                  <OrderBy>
                    <String>firstname</String>
                  </OrderBy>
                </IdentityFilter>
              </value>
            </entry>


            ownerNameSuggestBoxApprovalForward
            ownerNameSuggestBoxWorkItemListForward