cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Collecting errors when a workflow fails

Collecting errors when a workflow fails

The catches="complete" option on a workflow step guarantees that the step will run if we hit any runtime errors during workflow execution.

 

The step below called "StepToCreateError" will generate an error at runtime.

 

In the catches step named "Finalize", we will print out any errors that occurred in the workflow messages. 

 

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE Workflow PUBLIC "sailpoint.dtd" "sailpoint.dtd">

<Workflow explicitTransitions="true" name="Self Registration Test">

  <Variable initializer="string:true" input="true" name="trace"/>

  <Step icon="Start" name="Start">

    <Transition to="StepToCreateError"/>

  </Step>

  <Step icon="Default" name="StepToCreateError" posX="163" posY="24">

    <Script>

      <Source>

// Next line will generate an error...

System.out.println("this will cause an error for sure);

      </Source>

    </Script>

    <Transition to="Stop"/>

  </Step>

  <Step icon="Stop" name="Stop" posX="263" posY="24"/>

  <Step catches="complete" icon="Default" name="Finalize" posX="363" posY="24">

    <Script>

      <Source>

import java.util.ArrayList;

import java.util.Iterator;

import sailpoint.tools.Message;

 

 

System.out.println("Catches happened...");

//System.out.println("wfcase = " + wfcase.toXml());

 

ArrayList messages = wfcase.getMessages();

 

if (messages != null) {

    Iterator iter = messages.iterator();  

    while (iter.hasNext()) {

 

            Message next = (Message) iter.next();

            System.out.println("Message = " + next.toString());

                   

      }

}

 

      </Source>

    </Script>

  </Step>

</Workflow>

Labels (3)
Version history
Revision #:
3 of 3
Last update:
‎May 16, 2026 11:23 PM
Updated by: