Creating table in Review page

Which IIQ version are you inquiring about?

8.4p2

Share all details about your problem, including any error messages you may have received.

I have a form where user IDs are taken as input. I want to create a review page based on the input IDs, along with Email(auto-fetched) in table format shown up in review page. How to do in table. The table should contain two coumns: User ID, Email. The data from the form should populate itself in review page as table.

This might help in your case. add it in your workflow

<Step icon="Default" name="Generic Step" posX="320" posY="121">
    <Approval name="User Details Form" owner="ref:launcher" return="identityModel" send="identityModel">
      <Arg name="workItemFormBasePath" value="identityModel"/>
      <Form name="User Details Form">
        <Attributes>
          <Map>
            <entry key="pageTitle" value="User Details Form"/>
          </Map>
        </Attributes>
        <Description>Second Form</Description>
        <Section name="Section 12" type="text">
          <Field displayName="User Info" filterString="htmlRender" name="tableData" type="text">
<Attributes>
              <Map>
                <entry key="contentIsEscaped" value="true"/>
              </Map>
            </Attributes>
            <Script>
              <Source> import sailpoint.object.Filter;
              import sailpoint.object.IdentityEntitlement;
              import sailpoint.object.Link;
              import sailpoint.object.QueryOptions;
              import sailpoint.tools.GeneralException;
              import sailpoint.tools.Util;
              import org.apache.commons.logging.Log;
              import org.apache.commons.logging.LogFactory;

              Log log = LogFactory.getLog("sailpoint.bsh.demo");

            
Iterator it = null;
        boolean roleWithApp = false;
        List users = new ArrayList();
        String mainStr = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"border-collapse:collapse;\">\n" +
                "  &lt;tr>\n" +
                "    &lt;th>ID&lt;/th>\n" +
                "    &lt;th>Display Name&lt;/th>\n" +
                "    &lt;th>Email&lt;/th>\n" +
                "  &lt;/tr>\n";
        try {
            String applicationName = (String) identityModel.get("applicationName");
            String roleName = (String) identityModel.get("roleName");

            QueryOptions options = new QueryOptions();
            options.setCloneResults(true);

            if (Util.isNotNullOrEmpty(roleName)) {
                options.addFilter(Filter.and(Filter.eq("value", roleName)));
                options.add(new Filter[]{Filter.or(Filter.eq("name", "assignedRoles"))});
                it = context.search(IdentityEntitlement.class, options);
                roleWithApp = true;
            } else {
                // fetch users with app
                options.addFilter(Filter.and(Filter.and(Filter.eq("application.name", applicationName))));
                it = context.search(Link.class, options);
            }

            while (it != null &amp;&amp; it.hasNext()) {
                if (roleWithApp) {
                    IdentityEntitlement identityEntitlement = (IdentityEntitlement) it.next();
                
 									mainStr += "&lt;tr>\n" +
                            "&lt;td>" + identityEntitlement.getIdentity().getName() + "&lt;/td>\n" +
                            "&lt;td>" + identityEntitlement.getIdentity().getDisplayName() + "&lt;/td>\n" +
                            "&lt;td>" + identityEntitlement.getIdentity().getEmail() + "&lt;/td>\n" +
                            "&lt;/tr>\n";

                
                } else {
                    Link link = (Link) it.next();
                    if (link.getIdentity() != null) {
                        mainStr += "&lt;tr>\n" +
                            "    &lt;td>" + link.getIdentity().getName() + "&lt;/td>\n" +
                            "    &lt;td>" + link.getIdentity().getDisplayName() + "&lt;/td>\n" +
                            "    &lt;td>" + link.getIdentity().getEmail() + "&lt;/td>\n" +
                                "&lt;/tr>\n";
                    }
                }
            }
            mainStr += "&lt;/table>";

        } catch (GeneralException e) {
            log.error("Exception thrown while fetching identities : " + e.getMessage());
        }

        return mainStr;

                
              </Source>
            </Script>
          </Field>
        </Section>
        <Button action="next" label="Next" parameter="userAction" value="next"/>
        <Button action="cancel" label="Cancel" parameter="userAction" skipValidation="true" value="cancel"/>
      </Form>
    </Approval>
    <Transition to="Stop"/>
  </Step>

We have an open source library that really simplifies this: src/com/identityworksllc/iiq/common/table · main · pub / IIQ Common Public · GitLab

I am facing this issue, how to resolve it
image

just add the Attributes to the text type field.

<Attributes>
              <Map>
                <entry key="contentIsEscaped" value="true"/>
              </Map>
            </Attributes>

Fully updated one:

<Field displayName="User Info" filterString="htmlRender" name="tableData" type="text">
<Attributes>
              <Map>
                <entry key="contentIsEscaped" value="true"/>
              </Map>
            </Attributes>
            <Script>
              <Source> import sailpoint.object.Filter;
              import sailpoint.object.IdentityEntitlement;
              import sailpoint.object.Link;
              import sailpoint.object.QueryOptions;
              import sailpoint.tools.GeneralException;
              import sailpoint.tools.Util;
              import org.apache.commons.logging.Log;
              import org.apache.commons.logging.LogFactory;

              Log log = LogFactory.getLog("sailpoint.bsh.demo");

            
Iterator it = null;
        boolean roleWithApp = false;
        List users = new ArrayList();
        String mainStr = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"border-collapse:collapse;\">\n" +
                "  &lt;tr>\n" +
                "    &lt;th>ID&lt;/th>\n" +
                "    &lt;th>Display Name&lt;/th>\n" +
                "    &lt;th>Email&lt;/th>\n" +
                "  &lt;/tr>\n";
        try {
            String applicationName = (String) identityModel.get("applicationName");
            String roleName = (String) identityModel.get("roleName");

            QueryOptions options = new QueryOptions();
            options.setCloneResults(true);

            if (Util.isNotNullOrEmpty(roleName)) {
                options.addFilter(Filter.and(Filter.eq("value", roleName)));
                options.add(new Filter[]{Filter.or(Filter.eq("name", "assignedRoles"))});
                it = context.search(IdentityEntitlement.class, options);
                roleWithApp = true;
            } else {
                // fetch users with app
                options.addFilter(Filter.and(Filter.and(Filter.eq("application.name", applicationName))));
                it = context.search(Link.class, options);
            }

            while (it != null &amp;&amp; it.hasNext()) {
                if (roleWithApp) {
                    IdentityEntitlement identityEntitlement = (IdentityEntitlement) it.next();
                
 									mainStr += "&lt;tr>\n" +
                            "&lt;td>" + identityEntitlement.getIdentity().getName() + "&lt;/td>\n" +
                            "&lt;td>" + identityEntitlement.getIdentity().getDisplayName() + "&lt;/td>\n" +
                            "&lt;td>" + identityEntitlement.getIdentity().getEmail() + "&lt;/td>\n" +
                            "&lt;/tr>\n";

                
                } else {
                    Link link = (Link) it.next();
                    if (link.getIdentity() != null) {
                        mainStr += "&lt;tr>\n" +
                            "    &lt;td>" + link.getIdentity().getName() + "&lt;/td>\n" +
                            "    &lt;td>" + link.getIdentity().getDisplayName() + "&lt;/td>\n" +
                            "    &lt;td>" + link.getIdentity().getEmail() + "&lt;/td>\n" +
                                "&lt;/tr>\n";
                    }
                }
            }
            mainStr += "&lt;/table>";

        } catch (GeneralException e) {
            log.error("Exception thrown while fetching identities : " + e.getMessage());
        }

        return mainStr;

                
              </Source>
            </Script>
          </Field>
        </Section>

It is same even with using contentIsEscaped. Does not solve the issue.
image

I am looking for native solution. Do let me know if there is a way

try this below.

<Section name="Section 15" type="text">
          <Field displayName="User Info" filterString="htmlRender" name="tableData" type="text">
            <Attributes>
              <Map>
                <entry key="contentIsEscaped" value="true"/>
              </Map>
            </Attributes>
            <Script>
              <Source>
                
               
                String html = "&lt;table border=\"1\" cellpadding=\"3\" cellspacing=\"3\" width=\"100%\" style=\"border-collapse:collapse;\">\n" +
"  &lt;tr>\n" +
"    &lt;th>ID&lt;/th>\n" +
"    &lt;th>Display Name&lt;/th>\n" +
"    &lt;th>Email&lt;/th>\n" +
"  &lt;/tr>\n" +
"  &lt;tr>\n" +
"    &lt;td>user1&lt;/td>\n" +
"    &lt;td>John Doe&lt;/td>\n" +
"    &lt;td>[email protected]&lt;/td>\n" +
"  &lt;/tr>\n" +
"  &lt;tr>\n" +
"    &lt;td>user2&lt;/td>\n" +
"    &lt;td>Jane Smith&lt;/td>\n" +
"    &lt;td>[email protected]&lt;/td>\n" +
"  &lt;/tr>\n" +
"  &lt;tr>\n" +
"    &lt;td>user3&lt;/td>\n" +
"    &lt;td>Mike Johnson&lt;/td>\n" +
"    &lt;td>[email protected]&lt;/td>\n" +
"  &lt;/tr>\n" +
"&lt;/table>";


return html;
                
        

                
              </Source>
            </Script>
          </Field>
        </Section>

1 Like

yes this works. I am able to get the table now from what you suggested. It is hardcoded though

Also when I am trying to populate the data dynamically from form 1 user ID into this table, data comes as 1 string in 1 row, all the other table parts are empty.

My approach was I used delimiter to separate values and to get email for each ID in userID through context.getObjectByName(Identity.class, ID)

For reference our table class is open source along with many other useful utilities.