Process Flow Exception Handling

Requirement – Capture errors in the process flow and email the error details along with other relevant information.

Solution

  • In case exception handling needs to be done for an individual step in process flow right click on the activity on the process designer canvas and select “Service Exception Dialog”
  • In case exception handling need to be done for all the steps in process flow right click on the “OnException Scripts” tab and click “Edit Service exception”

Paste the code template below along with additional process flow specific information

import com.adeptia.indigo.TransactionExecutor;

import java.io.StringWriter;

 

StringWriter sw = new StringWriter();

String errorMessage = exception.getMessage();

if (errorMessage != null

                                && !errorMessage.trim().equalsIgnoreCase("")) {

                sw.write(errorMessage + ".\nError Details-\n");

}

exception.printStackTrace(new PrintWriter(sw));

//set error details

context.put("ExceptionMessage", sw.toString());

 

/*Set Variables that have other process flow(or business) specific information

String sponsorID = (String)context.get("SponsorID");

String transactionSetID = (String)context.get("TransactionSetID");

String siteID = (String)context.get("SiteID");

*/

 //pass all the above variables to the child flow

HashMap childCtxMap = new HashMap();

childCtxMap.put("ExceptionMessage",  sw.toString());

//Note here the process flow that does the actions that need to be done on errors is referred by the unique ID (Highlighted in yellow)

TransactionExecutor.executeTransactionWithTransID(childCtxMap,"192168038102138781949537000003", service.getSubject(), true);

  • In the process flow called above all the error information is available in the context and can be used accordingly  like sending the error in an email or dumping in an custom error database table

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.