Wednesday, November 27, 2019

Sailpoint Identity IQ Reading Data from Custom Table

Reading Data from the Custom Table created in the Sailpoint identity IQ Database ,
Once the table is created within the IdentityIQ database, it can be queried like any JDBC connection.  However, the advantage of using a table within the IdentityIQ database is that the connection to the database can be obtained from the IIQ context rather than having to store the URL, username, and password within the code itself.

Below sample code can be used in any places , such as showing the data in the Form (from custom table) , Rules or Workflow

   List itemList = new ArrayList();
            
   try{

   String  columnSearch = "ACCOUNT_ID";
   String  tableName = "VIS_SERVICE_ACCOUNT";
   String  conditionColumnName = "ACCOUNT_ID";
   String  sqlStatement ="select "+columnSearch+" from "+tableName;
   Iterator it = context.search("sql:"+sqlStatement, null,null);

    while ((null != it) && it.hasNext()) {
      String i= it.next();
      if(!itemList.contains(i)) {
       itemList.add(i);
      }
    }
   Util.flushIterator(it);
   }
   catch(GeneralException ex){
    logger.error("Error in form : " +ex.getMessage());
   }
   return itemList;