Multiple Instances of a Flow
Use the 'Submit Another Task' task to automatically repeat a task multiple times with a single submission of the flow.
You can define rules to control the task iteration. For example, define a rule to automatically submit a report task for each TRU within your organization.
If you need to correct a task, such as rerun a report task, this action will be applied to all task iterations submitted using the 'Submit Another Task' task.
Consider these points before you create a flow and include Submit Another Task, to initiate task iterations.
Task Name
Submit Another Task takes the task name as the input parameter and uses the repeat formula to execute multiple iterations of a task.
Task Repeat Formula
The Task Repeat Formula is a prerequisite for the flow and it decides the repetition logic and drives the iteration. When you create the repeat formula, use the 'Task Repeat' formula type. The input parameters are predefined for an input task. You can add them as flow parameters during flow creation. The formula return values are used to validate the task parameters.
Parameters
Task parameters submit the information required for the task submissions to complete successfully. The flow has these two sets of parameters:
-
Parameters for Submit Another Task
-
Parameters for the repeat submission task that's submitted multiple times
Use any of these options as input values for the repeat submission task:
-
Task parameters from the flow parameters defined while creating the flow
-
Return parameters from the repeat formula
Use any of these options as flow parameter values:
-
If the task parameter name, exposed in the UI at the flow-level, matches the Base Flow Parameter Name, then the values are used directly.
-
If the task parameter names don't match the Base Flow Parameter Name, the application uses a fast formula function to pass the flow parameter values as the task parameters. This formula function is built into the repeat formula.
For example, assume that you have defined the flow parameter as 'Effective Date', and the corresponding Base Flow Parameter Name is 'EFFECTIVE DATE'. The application uses formula function
GET_FLOW_PARAM_VALUE ()
and stores the return value of this formula function in the task parameter 'EFFECTIVE DATE'. The formula function is:-
*EFFECTIVE DATE=GET_FLOW_PARAM_VALUE
('Effective Date')
-
Provide the correct parameter basis when you define the task parameters. Some of the static parameters like the Effective Date or the Start Date can have a parameter basis value of 'Bind to Flow'. The dynamic parameters like the Payroll Statutory Unit ID are derived from the database tables. Hence you can have a parameter basis value of 'Bind to Flow Task' or 'Context Binding'. If you have defined specific names for the flow task parameters, you must ensure that the same names are used in the repeat formula.
Alternately, use the return parameters from the repeat formula as the task parameters. In this case the input parameters for the repeat formula are only the Base Task Name and the Repeat Counter. While calling the formula, the application uses these two parameters to get the context of the job submission. You create the Repeat formula to return input values for the submission task.
The formula output Repeat Flow decides if another job submission has to be done.
These parameters can be static or dynamic parameters. For example, for the Archive End-of-Year Payroll Results process the following parameters are defined as static parameters:
-
Effective Date
-
Start Date
-
Tax Year Date
-
Repeat Counter
The Repeat Counter is a static variable and is maintained by the application. During the iteration process this parameter increments by '1' after every submission.
In this example, these are the dynamic parameters for each submission:
-
Payroll Statutory Unit ID
-
Repeat Flow
However, you can also define the Tax Year as a dynamic parameter, so that you can generate the report for various years.
Maximum Repeat Counter
Specify a threshold limit for the maximum number of instances that can be executed for a single submission of the task. If the iteration runs into an error, this parameter prevents the process from getting into an infinite loop. A repeat counter N indicates one parent and N-1 child submissions.
Repeat Flow Parameter
The repeat flow parameter indicates when the task iteration should stop. A repeat flow instance is submitted only if the repeat flow parameter is set to 'Y'.
Execute in Parallel
Execute the submissions in parallel or serial. For parallel submissions, the number of threads is taken into consideration. A number of submissions equivalent to the number of threads is submitted in parallel. For serial submissions, number of submissions equivalent to the Repeat Counter is executed one after the other.
If you have set the Execute in Parallel parameter to 'Yes', you must specify a value for the Maximum Parallel Threads. This parameter is taken into consideration for a parallel submission.
For example, if you specify a value of X, during a submission, the application processes X instances of the task initially. The parent task waits for X child submissions to complete, evaluates the fast formula and executes another set of X child submissions to complete. This cycle continues till the Maximum Repeat Counter submissions are completed or the Repeat Flow value is 'N'.
It is recommended to execute the flow with parallel threads, especially for large volumes of data.
Parent Log File
After completion of the flow, use the Task Iterations page from the Process Results Summary and view the ESS Log file to view the details of the input parameters for each job submission. The Output and Log Files section displays one set of flow instance details and parameter values for the parent submission and similar set of values for each subsequent child submission.
-
Click on the Process ID on the first row to view the log output details of the flow.
-
Click on the Process ID on the second row or any other row below to view the log output of a task iteration or child submission.