Translate

Thursday, April 25, 2013

Custom task in SailPoint IIQ

Custom tasks are quite useful in SailPoint implementations. Customers brings up lot of different requirements for reporting and certifications which cannot be achieved using default tasks or ootb configurations.

Custom tasks also speeds up the process if the code is written accurately.

In this post I will explain how to build the custom task in SailPoint.

1. First you need to create a task definition with required parameters (jnput and output), which is required for the custom class java method which executes in background.

Sample custom task.xml

< ?xml version='1.0' encoding='UTF-8'? >
< !DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd" >
< TaskDefinition executor="sailpoint.custom.AbhiA"  name="AbhiACustom" progressInterval="5000" progressMode="String" template="true" resultAction="Delete" type="Generic" >
  < Description >Run Multiple aggregation< /Description  >
  < Signature >
    < Inputs >
      < Argument name="application" required="true" type="Application"  >
        < Prompt >Search Application< /Prompt >
      < /Argument >
     < /Inputs>
    < Returns>
      < Argument name="output" type="String" >
        < Prompt >Result< /Prompt >
      < /Argument >
     
    < /Returns >
  < /Signature >
< /TaskDefinition >


Explanation:-
  •  < TaskDefinition executor="sailpoint.custom.AbhiA"   this defines the name of the class which will be executed to execute the task
  •  < Argument name="application" required="true" type="Application" > this defines the input parameter of the task. The custom java code AbhiA will take input parameter as "application" variable. The type="Application" will create a drop down for application. Similarly you can have a type text for simple text input.
  • < Prompt >Search Application< /Prompt > this defnes the text which will be displayed in UI to the user.
  •  &lt; Returns > < Argument name="output" type="String" >  this defines the output parameter, in the custom task java code all output result will be passed to this output string.

2. Now create you java class to define the method for custom task


package sailpoint.custom;

import sailpoint.api.SailPointContext;
import sailpoint.object.Attributes;
import sailpoint.object.TaskResult;
import sailpoint.object.TaskSchedule;
import sailpoint.task.AbstractTaskExecutor;

public class AbhiA extends AbstractTaskExecutor {

      public void execute(SailPointContext ctx, TaskSchedule tshd,               TaskResult result, Attributes args)
      throws Exception {

            String output = "output";

            String appname = (String) args.get("application");
            result.setAttribute(output, "Hi Custom task executed" + appname);
      }

      public boolean terminate() {

            return false;
      }

Explanation:-
  •  The custom class will extend the AbstractTaskExecutor task and implements the execute method.
  •  To get the input arguments for the task defined in SailPoint use the following statement args.get("application") where "application" is the name defines in customtask.xml file.
  •   To redirect the result of your task to the output paramter defined in customtask.xml use the following statemen    result.setAttribute(output, "Hi Custom task executed" + appname);



3. Execute the task and you are done!!



7 comments:

  1. Hello abhishek.. I am working on something similar to what you have mentioned in your blog. I need your help. I am new to sailpoint and i have to deliver a code where i have to fetch application name, instance name, entitlement name etc from sailpoint context.. Can you please help me with the code for the same??

    ReplyDelete
  2. Hello gunpreet, are you aware of sailpoint javadoc , which has all the funtions to get application name, entitlement name etc... if no then go through the java doc and you will get all the required functions, which can be used from context.

    ReplyDelete
    Replies
    1. Hello abhishek. Yes i am aware but was not of much help. Finally i could figure out from the page that data is being stored in json and i can fetch it from there. Now i could get the row id from which i will fetch the details of the row for which we are customizing to seek clarification feature. Can you suggest something on this? My task is to customize the ui and add a help button to entitlement where manager can seek more clarification. When this button is clicked the details of user , applicatication etc is to be fetched and stored in database.

      Delete
    2. where do you want this UI button in the certification page?in 5.5 the UI customization is very limited, in 6.0 u can play with UI more. Check the UI Customization through UIConfig document avialable in compass, which describes what all option you have to modify UI.

      Delete
  3. Thank you very much Abhishek , Please write more topics about IIQ for beginners like me it's very useful.

    ReplyDelete
  4. Hi, Pls how do you execute this task in sailpoint IIQ. Basically how can i test this code of yours.
    Thanks.

    ReplyDelete
  5. java code to send Email

    System.out.println("in the preiterate rule of isecure Blog");
    import java.io.IOException;
    import java.nio.file.*;
    import java.nio.file.attribute.*;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.lang.Object;

    System.out.println(application.getAttributes().getString("file"));

    Date file = new Date();

    System.out.println("Day of given date : " + file.getDate());

    i want to read the date of the file and send Email to the admin through java code. above i have return some code which is pulling path of the file and todays date . please provide me the exact code to read the date and send email to the admin using getDate() and setTo() methods

    ReplyDelete