In one of my custom form I have configured custom fields to display identity list. whenever I touch the identity list dropdown it throws exception.
Could anyone help?
I have attached the rule part and error screen and ui view for reference.
Rule part:
<Field columnSpan="4" dependencies="selection,userId" displayName="Application" dynamic="true" hidden="true" name="ownedObjectsSingle" postBack="true" type="object">
<Attributes>
<Map>
<entry key="hidden" value="script:return form.getField("selection").getValue().equals("Bulk");"/>
</Map>
</Attributes>
<Script>
<Source>
import sailpoint.object.Application;
import sailpoint.object.QueryOptions;
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import sailpoint.object.Field;
import sailpoint.object.Form;
import sailpoint.object.Form.Section;
try {
String selectionValue = form.getField("selection") != null ? (String) form.getField("selection").getValue() : "";
if (!"Bulk".equals(selectionValue)) {
String content ="";
String userId = form.getField("userId") != null ? (String) form.getField("userId").getValue() : "Adam.Kennedy";
Identity selectedUser = context.getObjectByName(Identity.class, userId);
if (selectedUser != null) {
QueryOptions appQueryOptions = new QueryOptions();
appQueryOptions.addFilter(Filter.eq("owner", selectedUser));
List applicationsList = context.getObjects(Application.class, appQueryOptions);
Section section = form.getSection("ownedObjectsSection");
section.setColumns(4);
if (applicationsList != null && !applicationsList.isEmpty()) {
for (Application app : applicationsList) {
Field f = new Field();
f.setType(Field.TYPE_BOOLEAN);
f.setName("app_" + app.getName());
f.setDisplayName(app.getName());
f.setValue(false);
f.setColumnSpan(2);
section.add(f);
String description = "No description available";
Map descriptions = app.getDescriptions();
if (descriptions != null) {
if (descriptions.containsKey("en")) {
description = descriptions.get("en");
} else if (!descriptions.isEmpty()) {
description = descriptions.values().iterator().next();
}
}
// Add the description below the application name with proper indentation and italic styling
content += "<div style='margin-left: 40px; font-style: italic;'>";
content += "Description: " + description;
content += "</div>";
Field identityField = new Field();
identityField.setType(Field.TYPE_IDENTITY);
identityField.setName("identitySingle" + app.getName());
identityField.setDisplayName("");
identityField.setFilterString("inactive==true");
identityField.setValue("");
identityField.setColumnSpan(2);
section.add(identityField);
}
} else {
log.error("No applications found for this user");
}
} else {
log.error("User not found: " + userId);
}
} else {
log.info("Selection is Bulk, skipping application objects generation.");
}
} catch (Exception ex) {
log.error("Error retrieving data: " + ex.getMessage());
}
</Source>
</Script>
</Field>
Ui VIew:
Error Message: