Delete Provisioning Forms

Which IIQ version are you inquiring about?

Version 8.2

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

we have around 120 provisioning form which are not submitted during SP to AD provisioning. we rectify the problem and now we need to rerun “refresh identity cube task” but before that I need to remove all the forms which are already generated.
Is there any way to do so all in one shot using IIQ console ?

Thanks in ADV mate !!

you can find these WorkItem delete from the IIQ console or create rule to delete these.

Hi @ikabir ,

Every WorkItem has a WorkflowCase!
If you want to delete a WorkItem you have the delete the parent object, the WorkflowCases.
If you only delete the WorkItem, the WorkflowCase can get stuck forever in your system. That is bad and can cause errors in other processes and tasks.

Sample snippet for your reference -

Terminator term = new Terminator(context);
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.like("name", workflowCaseName, Filter.MatchMode.START));
Iterator it = context.search(WorkflowCase.class, qo, "id");
while(it.hasNext()){ 
    String id = (String) it.next()[0];
    WorkflowCase wfCase = context.getObject(WorkflowCase.class, id);
    if(wfCase != null){
        term.deleteObject(wfCase);
    }
    else{ 
        logger.info("workflowcase is null " + name);
    }
}

Hope this might help. Mark it as solved, If it helps.

Hi @ikabir ,

Please find the rule below which I have used in the past

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="WorkflowCasesDeletionRule">
  <Description>

    Searches for WorkflowCases and terminates them.

  </Description>
  <Source>

  import sailpoint.object.*;
  import sailpoint.api.Terminator;
  import java.util.*;
  import org.apache.log4j.Logger;
  import org.apache.log4j.Level;

  Logger logger = Logger.getLogger("sailpoint.DeleteOldWorkflowCases");
  logger.setLevel(Level.INFO);

  boolean simulation = false; // Set this value to true if it is just a simulation
  String workflowCaseName = "Refresh identity Jacob";  //Provide the WorkflowCase Name

  int daysGapToDelete = 0;    // Set this Ineteger to the days how long workflowCases should be kept. ex.: 1 = delete all WFCases older than 1 day !
  int countDeletedWorkflows = 0;
  Map keepCaseMap = new HashMap();

  logger.info("Delete Old Refresh gestartet -->" + workflowCaseName);


  Terminator term = new Terminator(context);

  // Now minus gap days
  Calendar cal = new GregorianCalendar();
  cal.add(Calendar.DATE, -daysGapToDelete);
  Date cutOffDate = cal.getTime();
  
  QueryOptions qo = new QueryOptions();
  qo.setCloneResults(true);
  qo.addFilter(Filter.lt("created", cutOffDate ));
  qo.addFilter(Filter.like("name", workflowCaseName, Filter.MatchMode.START));

  Iterator it = context.search(WorkflowCase.class, qo, "id");

  while(it.hasNext()){ 
    String id = (String) it.next()[0];
    WorkflowCase wfCase = context.getObject(WorkflowCase.class, id);
    if(wfCase != null){
      logger.info("found workflow for termination " + wfCase.getId() + " - " + wfCase.getName() );
      if(!keepCaseMap.containsValue(wfCase.getId()) &amp;&amp; !simulation){
        logger.info("Identity: " + wfCase.getTargetName() + " --> deleting old workflow case " + wfCase.getId() + " - " + wfCase.getName() + " " + countDeletedWorkflows);
        term.deleteObject(wfCase);
        countDeletedWorkflows++;
        logger.info("countDeletedWorkflows =" + countDeletedWorkflows);
      }
    }else{
      logger.info("workflowcase is null " + name);
    }

    if(!simulation){
      if (countDeletedWorkflows % 10 == 0) {
        context.commitTransaction();
      }
    }else{
      logger.info("Simulation is true --> no commits");
    }
  }

  if(!simulation){
    context.commitTransaction();
  }else{
    logger.info("Simulation is true --> no commits");
  }

  logger.info("Delete Old Refresh done -->" + workflowCaseName);
  return "done --> deleted --> " + countDeletedWorkflows;
  </Source>
</Rule>

Hi Hemant,

Thanks for the update, deleted them using IIQ console.

delete Workitem *
delete Workflowcase *

these two fill my requirement which was to delete provisioning forms.

Hi @officialamitguptaa

Thanks for code snippet,

I’m looking for code to filer out pending workitem for specific identity and terminate workflowcase.

Filter f=Filter.and((Filter.eq(“type”, “Approval”)),(Filter.eq(“state”, “Pending”)),(Filter.eq(“WorkflowCaseRef”, “identityName”)));

or

Filter.ignoreCase(Filter.like(“WorkflowCaseRef.name”,identityName,Filter.MatchMode.ANYWHERE))

but something is missing and its not working out as expected.below is my Workiteam

1 Like

<WorkflowCaseRef><Reference class="sailpoint.object.WorkflowCase" id="2ebee3a08dae1d5f818daeac83d8084f" name="XXX: 1A6B5E5F5D558CD1"/>/WorkflowCaseRef></WorkItem>

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