Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected links that should have been relative instead of absolute.

This section is applicable only for the users of Adepta Connect.

Anchor
Process_Flow
Process_Flow
Using Process Flow in a Template

While creating a Process Flow, in the Process Designer, write the following script in the Service exception field under the OnException Scripts tab.  

...

Info
import org.apache.commons.lang.exception.ExceptionUtils;
Throwable rootCause = ExceptionUtils.getRootCause(exception);
String exceptionMessage = null;
if(rootCause == null)
exceptionMessage = exception.getMessage();
else
exceptionMessage = rootCause.getMessage();

context.put("subprocess_code", "ERROR_IN_CHILD_FLOW");
context.put("subprocess_text", exceptionMessage);

Anchor
Process_Flow_Call_Process_Flow
Process_Flow_Call_Process_Flow
Process Flow Calling Another Process Flow

If the Process Flow is further calling a Transactionanother Process Flow, you need to must create a custom plugin using below JavaScript. After you have created a custom plugin, use it in the Process Flow just before a Call or Spawn activity. In case there are multiple Call or Spawn activities in a Process Flow, you need to add a Custom Plugin before every Call or Spawn activity.

JavaScript  for Custom Plugin to set child context Param and other required information to call another process flow:

  1. When streaming is passed to child flow in File Mode:
    import com.adeptia.connect2.runtime.RuntimeUtils;
    RuntimeUtils.setChildContextForCustomFlow(inputStream, context, service.getLogger(), "<<ACTION_NAME>>");

    where,

    ACTION_NAME is the name of the call or spawn.

    for example,

    RuntimeUtils.setChildContextForCustomFlow(inputStream, context, service.getLogger(), "Action_Name");

    Info
    Ensure that the source activity is File Source when streaming is passed in File Mode and eventContextEnable is true.

    Ensure that you have provided the values <<ACTION_NAME>> in double quotes (" ").
  2. When streaming is passed to child flow in Memory Mode:

    import com.adeptia.connect2.runtime.RuntimeUtils;
    RuntimeUtils.setChildContextForCustomFlow(inputStream, context, service.getLogger(), "<<ACTION_NAME>>", true, "<<contextVarName>>");

    where,

    ACTION_NAME is the name of the call or spawn.       
    contextVarName is the name of the context variable that will be used as Key to put stream data on context.

    Info
    titleNote

    For In Memory mode, it is mandatory to use Context Source in child flow, if Context Source is used, then and eventContextEnable must be false.

    Ensure that you have provided the values <<ACTION_NAME>> and contextVarName in double quotes (" ").

  3. When no Stream is passed to child flow in:

    import com.adeptia.connect2.runtime.RuntimeUtils;
    RuntimeUtils.setChildContextForCustomFlow(context, service.getLogger(), "<<ACTION_NAME>>");

    where,

    ACTION_NAME is the name of the call or spawn.

    Info
    Ensure that you have provided the values <<ACTION_NAME>> in double quotes (" ").


JavaScript to check if child flow is Aborted or not:

...

         resultCtxVarName is the name of the context variable that contains the status of the sub-flow. The value can be Executed, Aborted, Queued, or Waiting.


JavaScript for Custom plugin to abort parent flow:

...

RuntimeUtils.abortParentFlow(context,"<<ACTION_NAME>>","<<resultCtxVarName>>");

Process Flow Design

Following are the sample designs of the Process Flow, calling a Transaction through Call or Spawn action:

...

Using Single Spawn

Using Multiple Spawn

Calling Transaction in Call or Spawn

To call a Transaction in Call or Spawn action:

...