Wednesday, 8 July 2020

Rules in Sailpoint

Rules are the construct through which IdentityIQ allows the addition of custom business logic at specific points within the execution flow of the product.

The below is the sample how to construct business logic, There are multiple application on-board to Sailpoint and the requirement is to get the mail of the user from an specific application HR System – Employees.


The below are the learning

1.
       How can we define a method in Rule (A Java method is a collection of statements that are grouped together to perform an operation.)
2.
       Link of an identity
3.
       How to test the rule in IIQ console



Code

      import sailpoint.object.Identity;
 import java.util.*;
 import sailpoint.api.*;
 import sailpoint.object.Link;
// Java Method
 
 public static String GetEmail(String user) {

 
 Identity id = context.getObject(Identity.class,user);
 List listOfLinks=id.getLinks();
 if(listOfLinks!=null){
                        for(Link link : listOfLinks)
                               {
                               if(link.getApplicationName().equals("HR System - Employees")){
                                 String emailofApp = link.getAttribute("email");
                                 return emailofApp;
                                }
                            }
                        }
                                           }


     String user = "Adam.Kennedy";
String emailofuser = GetEmail(user);   // Calling the Method
System.out.println("We have found the email of the user"+ " "+ emailofuser);

Save the above code in a Rule.
In IIQ Console.






1 comment:

ServiceNow onboarding Sailpoint