How to convert sailpoint list data into html table from rule

Which IIQ version are you inquiring about?

Version 8.3

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

How to convert sailpoint list data into html table from rule.

Hi Aman,
It depends what you wan’t to achieve. Generaly in the forms you can use any html you want to display data but I would recommend to check if it would not be better/easier to use some OoTB forms mechanisms. Here you can find some details

https://documentation.sailpoint.com/identityiq/help/forms/formsoverview.html?Highlight=form

it all depends where you are going to use this … in forms, EmailTemplate or any other place. anyway assuming we have list of HashMap and and you want to show the data in html table and you know keys of HashMap and table header in this below is the sample code which can be used

  List dataList = new ArrayList();
  HashMap data1 = new HashMap();
  data1.put("key1","value1");
  data1.put("key2","value2");
  HashMap data2 = new HashMap();
  HashMap data2 = new HashMap();
  data2.put("key1","value3");
  data2.put("key2","value4");
  dataList.add(data1);
  dataList.add(data2);
  StringBuilder htmlRepresentation = new StringBuilder();
  htmlRepresentation.append("<table id='table1'><tr><th>Key1</th> <th><b>Key2</b></th></tr>");
  for(HashMap dataMap: dataList){								               							
    htmlRepresentation.append("<tr style='border: solid 1px'>");
    htmlRepresentation.append("<td  style='word-break: break-all;'>");					
    htmlRepresentation.append(dataMap.get("key1"));
    htmlRepresentation.append("</td>");
    htmlRepresentation.append("<td word-break: break-all;'>");					
    htmlRepresentation.append(dataMap.get("key1"));
    htmlRepresentation.append("</td>"); 	
    htmlRepresentation.append("</tr>");							
  }
  return htmlRepresentation.toString();

If its in email template, 8.x version doesn’t allow you to send the html tags dynamically from rule, you have to use as below

In your rule have the Variables for example

 Map inputMap=new HashMap();

    inputMap.put("field1",field1value);
    inputMap.put("field2",field2value);

    inputMap.put("field3",field3value);

    inputMap.put("expiredDateStr",expiredDateStr);

    tableData.add(inputMap);

In Email template have something like this

    <table border='1' cellspacing='1' cellpadding='1' width='100%' style='width:100.0%;padding:0.5px'>
    <tr>
    <th>#</th>
    <th>Field1</th>
    <th>Field2</th>
    <th>Field3</th>
    </tr>

    #foreach($individualMap in $tableData)    <tr>
    <td style='text-align:center;'>$individualMap.field1</td>
    <td style='text-align:center;'>$individualMap.field2</td>
    <td style='text-align:center;'>$individualMap.field3</td>
    </tr>
    #end

    <tfoot>
    </tfoot>
    </table>

Please mark the solution if this helps you.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.