I have customized a form to update the ownership of objects from a terminated user to a new owner. My goal is to display each object, its description, and a new owner dropdown in the same row, using three different columns.
However, I’ve encountered some issues:
- When I set the section type as “text,” I cannot display the dropdown option.
- If I omit the section type, the HTML syntax is not supported, and the content is displayed as plain text.
How can I resolve this issue so I can correctly display the objects with the dropdown in the form? Additionally, I need to process the selected new owners for the objects. Is it possible to achieve this functionality?
Any suggestions or guidance would be appreciated! This is urgent requirement in my project.
reference image attached:
i want my form in this view.
Sample code i have tried:
import sailpoint.object.Application;
import sailpoint.object.QueryOptions;
import sailpoint.object.Filter;
import sailpoint.object.Identity;
import java.util.List;
import java.util.Map;
String content = "";
try {
String userId = form.getField("userId") != null ? (String) form.getField("userId").getValue() : "Adam.Kennedy";
Identity selectedUser = context.getObjectByName(Identity.class, userId);
if (selectedUser != null) {
// Fetch applications owned by the selected user
QueryOptions appQueryOptions = new QueryOptions();
appQueryOptions.addFilter(Filter.eq("owner", selectedUser));
List<Application> applicationsList = context.getObjects(Application.class, appQueryOptions);
// Fetch active identities for the New Owner dropdown
QueryOptions queryOptions = new QueryOptions();
queryOptions.addFilter(Filter.eq("inactive", false)); // Filter active identities
List<Identity> inactiveIdentities = context.getObjects(Identity.class, queryOptions);
// Start building the table content
content += "<table class='spTable' style='width:100%; border-collapse:collapse;'>";
content += "<tr><th style='border:1px solid black;'>Application</th><th style='border:1px solid black;'>Description</th><th style='border:1px solid black;'>New Owner</th></tr>";
if (applicationsList != null && !applicationsList.isEmpty()) {
for (Application app : applicationsList) {
String appName = app.getName();
String description = "No description available";
Map<String, String> descriptions = app.getDescriptions();
if (descriptions != null && !descriptions.isEmpty()) {
description = descriptions.getOrDefault("en", descriptions.values().iterator().next());
}
content += "<tr>";
content += "<td style='border:1px solid black;'>" + appName + "</td>";
content += "<td style='border:1px solid black;'>" + description + "</td>";
content += "<td style='border:1px solid black;'>";
content += "<select>";
// Loop through the inactiveIdentities and add options
for (Identity identity : inactiveIdentities) {
content += "<option value='" + identity.getName() + "'>" + identity.getName() + "</option>";
}
content += "</select>";
content += "</td>";
content += "</tr>";
}
} else {
content += "<tr><td colspan='3' style='border:1px solid black; text-align:center;'>No Applications Found</td></tr>";
}
content += "</table>";
} else {
content = "<font color='red'>User not found: " + userId + "</font>";
}
} catch (Exception ex) {
content = "<font color='red'>Error retrieving applications or identities: " + ex.getMessage() + "</font>";
}
if ("".equals(content)) {
content = "<font color='red'>Please select a user to see the owned applications.</font>";
}
return content;