Performance tuning in Form Fields

Hello Experts,

I have created a form and one of the field is an identity field where the user have to select before submitting the form. Now, I was able to successfully display the list of user for selection. But the problem is, since the user list is long list, IIQ is very slow in terms of displaying and making my instance slow during form submission.

Is it possible to add the option to load the list of user data like 5-10 user at once?
Adding “load more” option similar to this

I have attached the field query for reference

    <Field dependencies="Operation" displayName="Select a User" dynamic="true" name="User" postBack="true" required="true" type="sailpoint.object.Identity">
      <AllowedValuesDefinition>
        <Script>
          <Source>
import sailpoint.object.*;           
import sailpoint.object.Identity;
import sailpoint.object.Filter;
import sailpoint.object.QueryOptions;
import sailpoint.api.SailPointContext;
import sailpoint.tools.GeneralException;
import java.util.ArrayList;
import java.util.List;
import java.util.*;

Field f6 = form.getSection("Section 1").getField("Operation");
String f6value = f6.getValue();


List items = new ArrayList();

try {
    if ("Add Legal Hold".equalsIgnoreCase(f6value)) {
        // Define the filter for identities with a link to the "AD" application
         Filter app1 = Filter.eq("links.application.name", "AD");
        Filter app2 = Filter.eq("links.application.name", "AD2");

        // Add filter for identities where "ON_Legal_Hold" is not true
        Filter notOnLegalHold = Filter.ne("On_Legal_Hold", "true");

        // Combine filters
        Filter combined = Filter.and(Filter.or(app1, app2), notOnLegalHold);
        QueryOptions ops = new QueryOptions();
        ops.addFilter(combined);
        List saver = context.getObjects(Identity.class, ops);
		
        // Fetch identities with the specified filter
        for (Identity eachIdentity : saver ) {
            List l2 = new ArrayList();
            l2.add(eachIdentity.getId());
            l2.add(eachIdentity.getAttribute("displayName"));
            items.add(l2);
        }
    } else if ("Remove Legal Hold".equalsIgnoreCase(f6value)) {
        // Define the filter for identities in the "Executive Management" department
        Filter f1 = Filter.eq("On_Legal_Hold", "true");
        QueryOptions ops1 = new QueryOptions();
        ops1.addFilter(f1);
        List saver2 = context.getObjects(Identity.class, ops1);
        // Fetch identities with the specified filter
        for (Identity eachIdentity1 : saver2) {
            List l3 = new ArrayList();
            l3.add(eachIdentity1.getId());
            l3.add(eachIdentity1.getAttribute("displayName"));
            items.add(l3);
        }
    }
} catch (GeneralException e) {
    log.error("Error querying identities: " + e);
}

return items;

            
        </Source>
        </Script>
      </AllowedValuesDefinition>

Hi @BalajiChandrasekaran,

I dont know if it could possible manage the “Load more” in a AllowedValuesDefinition, but I think it dont resolve your problem.

The best way when manage a field whit the identites is using the filterString instead of code(rule or script).
In your case, to using filterString you must use 2 fields, one for “Add Legal Hold” and another for “Remove Legal Hold”, hiding the first or the second depending on the value Operation field.

Otherwise, you try to optimize your script:

  • Remove unnecessary import\library, with import sailpoint.object.* import java.util.* you are loading all library and you dont need
  • You return your list, the field doesnt need to be Identity like type, you can set like String. Your loading all the identies and dont use it.
  • Or, leave it like identity and return the list of identities without the for
1 Like

Hi @BalajiChandrasekaran ,

When you use filterString to populate the identities, it is possible to get the option to “loadmore” option.

2 Likes