Showing posts with label Form. Show all posts
Showing posts with label Form. Show all posts

Saturday, December 14, 2019

Sailpoint IIQ Quicklink Launch Workflow showing Form Value

Sailpoint IIQ Quicklink Launch Workflow showing Form Value

1. Create a quick link make sure the below category is created follow the step from the previous post

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE QuickLink PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<QuickLink action="workflow" category="Service Account Management" messageKey="Manage Service Account" name="Service Account View QuickLink">
  <Attributes>
    <Map>
      <entry key="workflowName" value="Service Account View Workflow"/>
    </Map>
  </Attributes>
  <Description>QuickLink to View Service Account in IIQ table</Description>
  <QuickLinkOptions allowSelf="true">
    <DynamicScopeRef>
      <Reference class="sailpoint.object.DynamicScope" name="Self Service"/>
    </DynamicScopeRef>
  </QuickLinkOptions>
</QuickLink>










2.Import the form created in the previous post

3.import the below Workflow

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Workflow PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Workflow explicitTransitions="true" name="Service Account View Workflow">
  <Variable editable="true" input="true" name="launcher">
    <Description>Launcher name.</Description>
  </Variable>
  <Variable initializer="true" name="transient"/>
  <Variable initializer="true" name="trace">
    <Description>Used for debugging this workflow and when set to true trace
      will be sent to stdout.</Description>
  </Variable>
  <Step icon="Start" name="Start" posX="229" posY="21">
    <Transition to="Display Form"/>
  </Step>
  <Step icon="Approval" name="Display Form" posX="427" posY="21">
    <Approval mode="serial" name="Display Form" owner="ref:launcher">
      <Arg name="workItemType" value="Approval"/>
      <Arg name="workItemDescription" value="Service Account Details"/>
      <Arg name="workItemForm" value="string:Service Account Details Form"/>
      <Arg name="workItemFormBasePath"/>
    </Approval>
    <Description>
       Display the Service Account form .
    </Description>
    <Transition to="Stop"/>
  </Step>
  <Step icon="Stop" name="Stop" posX="611" posY="21"/>
</Workflow>










Thursday, December 12, 2019

Sailpoint IIQ Form - Reading Value from IIQ Database


Below is the sample Form in which most of the value of the field is read from the IIQ Custom 
Table DB . in the previous posts we have seen the sample code for reading the data from IIQ Database.
Create a Table in IIQ Database name VIS_SERVICE_ACCOUNT with below fields

ACCOUNT_ID
APPLICATION_NAME
ACCOUNT_DESCRIPTION
OWNER
INTERACTIVE


    
    
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE Form PUBLIC "sailpoint.dtd" "sailpoint.dtd">
    <Form name="Service Account Details Form" type="Workflow">
      <Attributes>
        <Map>
          <entry key="pageTitle" value="Service Account Details Form"/>
        </Map>
      </Attributes>
      <Section>
        <Field displayName="Account Identifier" helpKey="Account ID of Service Account" name="accountID" postBack="true" required="true" type="string">
          <AllowedValuesDefinition>
            <Script>
              <Source>
       import sailpoint.tools.Util;
       import sailpoint.tools.GeneralException;
       import org.apache.log4j.Logger;
    
       Logger logger= Logger.getLogger("vis.form.ServiceAccount.fields");
    
       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) &amp;&amp; it.hasNext()) {
          String i= it.next();
          if(!itemList.contains(i)) {
           itemList.add(i);
          }
        }
       Util.flushIterator(it);
       }
       catch(GeneralException ex){
        logger.error("Error in AppEdit form : " +ex.getMessage());
       }
       return itemList;
              </Source>
            </Script>
          </AllowedValuesDefinition>
        </Field>
        <Field displayName="Application Name" displayType="combobox" helpKey="Application Name of the Service Account" name="applicationName" postBack="true" required="true" type="string">
          <AllowedValuesDefinition>
            <Script>
              <Source>
       import sailpoint.tools.Util;
       import sailpoint.tools.GeneralException;
       import org.apache.log4j.Logger;
    
       Logger logger= Logger.getLogger("vis.form.ServiceAccount.fields");
       List itemList = new ArrayList();
                
       try{
    
       String  columnSearch = "APPLICATION_NAME";
       String  tableName = "VIS_SERVICE_ACCOUNT";
       String  conditionColumnName = "ACCOUNT_ID";
       String  sqlStatement ="select "+columnSearch+" from "+tableName + " where ACCOUNT_ID ='"+ accountID + "'";
                System.out.println("sqlStatement = " + sqlStatement);
       Iterator it = context.search("sql:"+sqlStatement, null,null);
    
        while ((null != it) &amp;&amp; it.hasNext()) {
          String i= it.next();
          itemList.add(i);
        }
       Util.flushIterator(it);
       }
       catch(GeneralException ex){
        logger.error("Error in AppEdit form : " +ex.getMessage());
       }
       return itemList;
              </Source>
            </Script>
          </AllowedValuesDefinition>
          <Attributes>
            <Map>
              <entry key="hidden">
                <value>
                  <Script>
                    <Source>if(accountID==null || accountID ==void){
                      return true;
                    }</Source>
                  </Script>
                </value>
              </entry>
            </Map>
          </Attributes>
        </Field>
        <Field displayName="Account Description" dynamic="true" helpKey="Description of Service Account" name="accountDescription" type="string">
          <Attributes>
            <Map>
              <entry key="hidden">
                <value>
                  <Script>
                    <Source>if(accountID==null || accountID ==void || applicationName==null || applicationName ==void){
                      return true;
                    }</Source>
                  </Script>
                </value>
              </entry>
              <entry key="readOnly" value="true"/>
            </Map>
          </Attributes>
          <Script>
            <Source>
              if(accountID!=null){
         String  columnSearch = "ACCOUNT_DESCRIPTION";
         String  tableName = "VIS_SERVICE_ACCOUNT";
         String  conditionColumnName = "ACCOUNT_ID";
         String  sqlStatement ="select "+columnSearch+" from "+tableName+" where "+conditionColumnName+"='"+accountID+"'"+" and APPLICATION_NAME ='"+applicationName+"'";
         Iterator  itr = context.search("sql:"+sqlStatement, null,null);
         while(itr.hasNext()){
          String accountDescription =  itr.next();
          if(accountDescription!=null){
         return accountDescription;
          }
         }
             }
            </Source>
          </Script>
        </Field>
        <Field displayName="Account Owner" dynamic="true" helpKey="Owner of the Service Account" name="owner" type="sailpoint.object.Identity">
          <Attributes>
            <Map>
              <entry key="hidden">
                <value>
                  <Script>
                    <Source>if(accountID==null || accountID ==void || applicationName==null || applicationName ==void){
                      return true;
                    }</Source>
                  </Script>
                </value>
              </entry>
              <entry key="readOnly" value="true"/>
            </Map>
          </Attributes>
          <Script>
            <Source>         
            if(accountID!=null){
         String  columnSearch = "OWNER";
         String  tableName = "VIS_SERVICE_ACCOUNT";
         String  conditionColumnName = "ACCOUNT_ID";
         String  sqlStatement ="select "+columnSearch+" from "+tableName+" where "+conditionColumnName+"='"+accountID+"'"+" and APPLICATION_NAME ='"+applicationName+"'";
         Iterator  itr = context.search("sql:"+sqlStatement, null,null);
         while(itr.hasNext()){
          String owner =  itr.next();
          if(owner!=null){
         return owner;
          }
         }
              }</Source>
          </Script>
        </Field>
        <Field displayName="Interactive" dynamic="true" helpKey="Service Account is Interactive or Non-Interactive" name="interactive" type="string">
          <AllowedValuesDefinition>
            <Value>
              <List>
                <String>Yes</String>
                <String>No</String>
              </List>
            </Value>
          </AllowedValuesDefinition>
          <Attributes>
            <Map>
              <entry key="hidden">
                <value>
                  <Script>
                    <Source>if(accountID==null || accountID ==void || applicationName==null || applicationName ==void){
                      return true;
                    }</Source>
                  </Script>
                </value>
              </entry>
              <entry key="readOnly" value="true"/>
            </Map>
          </Attributes>
          <Script>
            <Source>
              if(accountID!=null){
         String  columnSearch = "INTERACTIVE";
         String  tableName = "VIS_SERVICE_ACCOUNT";
         String  conditionColumnName = "ACCOUNT_ID";
         String  sqlStatement ="select "+columnSearch+" from "+tableName+" where "+conditionColumnName+"='"+accountID+"'"+" and APPLICATION_NAME ='"+applicationName+"'";
         Iterator  itr = context.search("sql:"+sqlStatement, null,null);
         while(itr.hasNext()){
          String interactive =  itr.next();
          if(interactive!=null){
         return interactive;
          }
         }
              }
            </Source>
          </Script>
        </Field>
      </Section>
      <Button action="back" label="Cancel"/>
    </Form>