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 (1)
Comments

Hi @chris_hajdu , we are trying to suppress error in task result for particular workflow failure, But wfcase.getMessages(); is coming as null also, wfcase.addMessage(null); method also not working we still see the error in task result. We are able to remove the error from identity request.

Thanks in Advance!

Version history
Revision #:
2 of 2
Last update:
‎Jul 26, 2023 05:32 PM
Updated by: