Automate Roll Back of Multiple QuickPay Runs
In this example, you use the Submit Another Task task to automatically roll back multipe QuickPay runs with a single flow submission.
- Create a value set to derive the transaction ID of the QuickPays already processed. The flow iterator uses the transaction IDs for the multiple iterations.
- Create the task iterator fast formula of type 'Task Repeat'.
- Create a user-defined flow and include the 'Submit Another Task' task for iterating the task.
Create a Value Set
- Select the Payroll Value Sets task in the Setup and Maintenance work area.
- On the Value Sets page, click Create and enter these values.
Field
Value
Value Set Code
ROLLBACKQPAY_VS
Description
QuickPay Rollback
Module
Payroll Flows
Validation Type
Table
Value Data Type
Number
FROM Clause
pay_payroll_actions pa, pay_requests pr
Value Column Name
pa.payroll_action_id
Value Column Type
VARCHAR2
Value Column Length
200
ID Column Name
pa.PAYROLL_ACTION_ID
ID Column Type
Number
ID Column Length
18
WHERE Clause
pa.pay_request_id(+) = pr.pay_request_id and pr.pay_request_id =( select pay_request_id from ( select t1.pay_request_id,rownum cnt from( select pr.pay_request_id,pfi.instance_name ,nvl(pa.payroll_action_id,-1) payroll_action_id from pay_flow_instances pfi, pay_flows pf, pay_requests pr, pay_payroll_actions pa where pfi.base_flow_id =pf.base_flow_id and pf.base_flow_name IN ('QUICK_PAY', 'QUICK_PAY_ONLY', 'QUICK_PAY_SIMPLIFIED') AND pr.flow_instance_id=pfi.flow_instance_id AND pa.pay_request_id(+) = pr.pay_request_id and pfi.instance_name like 'QuickPay_XXXX,' and pr.call_type='FLOW_TASK_INSTANCE' order by pr.pay_request_id desc )t1 ) where cnt=:{PARAMETER.COUNT} )
ORDER BY Clause
Note:-
The SQL in this table is a sample to demonstrate how you can use a value set to retrieve transactions for the QuickPay rollback iterations.
-
The Where Clause below the SQL is to restrict the rollback iterations to process only those flow instances beginning with the specified name. For example, 'QuickPay_XXXX' is used as the flow name in this example. 'XXXX' could represent day and month when the QuickPay runs are processed.
-
- Optionally, to secure the value set, select the Data Security check box and
provide the Data Security Resource Name.Note: You can enable data security only if the value set is based on a single table or view.
- Click Save.
- Set up a flow with just this value set.
- Verify that the flow generates the list of transaction IDs of the processed QuickPays.
- Verify that the QuickPay IDs are captured as a flow parameter value on the flow submission page.
-
Click Continue.
-
Enter this formula text details in the Formula Text Section.
1. FORMULA NAME: QP_ROLLBACK 2. FORMULA TYPE: Task Repeat 3. DESCRIPTION: Formula to roll back the QuickPays 4. Formula Results: Iterates the Roll Back QuickPay process 5. /* Inputs */ 6. INPUTS ARE FLOW_INSTANCE_ID, REPEAT_COUNTER, BASE_TASK_NAME (text) 7. DEFAULT FOR REPEAT_COUNTER IS 1 8. DEFAULT FOR FLOW_INSTANCE ID IS 1 9. DEFAULT FOR PAYROLL_PROCESS IS 1 10. COUNTER = to_char(REPEAT_COUNTER) 11. PAYACTION_ID = GET_VALUE_SET ('ROLLBACKQPAY_VS' ,'|=COUNT='|| COUNTER) 12. BASE_TASK_NAME = 'JAVA_API_ROLLBACK' 13. EXECUTION_MODE = 'SUBMIT' 14. EFFECTIVE_DATE = trunc(to_date(GLOBAL_PAY_INTERFACE_EXTRACTION_DATE,'YYYY-MM-DD')) 15. PAYROLL_PROCESS = PAY ACTION_ID 16. REPEATFLAG = 'Y' 17. /*Results*/ 18. RETURN REPEAT_COUNTER, REPEAT FLAG, BASE_TASK_NAME, EXECUTION_MODE, EFFECTIVE_DATE, PAYACTION_ID, PAYROLL_PROCESS 19. /* End Formula Text */
-
Click Compile.
-
Click Save.
Create the Task Repeat Formula
The Task Repeat Formula calls the value set you previously defined to retrieve the list of QuickPay transaction IDs for the QuickPays already processed. The formula return values are used to validate the task parameters for the Rollback Process in order to roll back in each iteration the current QuickPay in the iteration logic.
Use the text editor to create a fast formula and return the values required to run the Roll Back QuickPay process.
Complete these steps to create a repeat formula.
-
Use the Fast Formulas task in the Setup and Maintenance work area.
-
On the Fast Formulas page, click Create to create a formula.
-
On the Create Fast Formula page, complete these fields.
Field
Value
Formula Name
QP_Rollback
Formula Type
Task Repeat
Description
Formula to roll back QuickPay
Effective Start Date
Don't enter a value. It is derived by the task repeat formula.
Legislative Data Group
This formula isn't specific to any legislative data group (LDG) and hence you can leave this field blank.
Type of Editor
Text
Create a User-Defined Flow Pattern
-
On the Home page, navigate to Payroll in My Client Groups and select the Payroll Flow Patterns task.
-
Click Create to create a flow pattern. You can also search for and select an existing flow pattern to copy.
-
Leave the Legislative Data Group field blank and click Continue.
-
On the Basic Information page, complete these basic flow information fields.
Field
Value
Flow Pattern Name
Roll Back QuickPay
Description
Enter a description for the flow.
LDG Required
No
Activities to Include
Select Calculate.
-
Select Submit Another Task to include it in the flow pattern.
-
Select an Owner Type and Owner for the flow.
-
On the Task Sequence page, the sequence should appear as given here.
Task
Following Task
Start Task
Submit Another Task
Submit Another Task
End Task
-
On the Parameters page, use the Add icon and add the requisite flow parameters to complete the flow pattern.
- Before you add the parameters, click Next and review
the task parameters. The parameters associated with Submit Another Task are
automatically available. Ensure that the parameters are defined as given in
this table.
Name
Execution Mode
Data Type
Parameter Basis
Basis Value
Execute in Parallel
Submit
Text
Bind to Flow
Execute in Parallel
Legislative Data group
Submit
Long
Context Binding
Legislative Data group
Task Name
Submit
Text
Bind to Flow
Task Name
Task Repeat Formula
Submit
Text
Bind to Flow
Task Repeat Formula
Maximum Repeat Counter
Submit
Long
Bind to Flow
Maximum Repeat Counter
Request
Submit
Long
Context Binding
Request
Maximum Parallel Threads
Submit
Number
Bind to Flow
Maximum Parallel Threads
-
The flow parameters are used to submit and complete the tasks in the flow pattern, or as a basis for deriving values to submit the remaining tasks in the flow pattern.
-
If necessary update the parameters. After you have completed the requisite flow parameters, click Next.
-
Review the resulting checklist for the flow pattern.
-
Click Submit.
Submit the Flow
-
Select the Submit a Flow task from Quick Actions or under Payroll in My Client Groups on the Home page.
-
Search for Roll Back QuickPay flow and click Next.
-
Enter these parameters.
Field
Value
Payroll Flow
Enter a suitable name for the flow instance, for example Roll Back QuickPay_0105.
Schedule Select As soon as possible or select Using a schedule and enter the schedule details. Task Name
Roll Back Process
Task Repeat Formula
QP_Rollback
Maximum Repeat Counter
Maximum number of submissions or the number of iterations by the flow.
Note:A repeat counter N indicates one parent and N-1 child submissions.
Execute in Parallel
Decides if the submissions are in parallel or sequential. Select Yes, if you want to run the flow instances in parallel.
Note:It's recommended to run the threads in parallel for large volumes of data.
Maximum Parallel Threads
Maximum number of submissions executed in parallel.
Note:The Maximum Repeat Counter is the maximum number of instances that can be executed for a single submission of the task. It's the number of QuickPays processed in the payroll period and you intend to roll back using this flow. If the iteration runs into an error, this parameter prevents the process from getting into an infinite loop.
-
Click Submit.
When you submit a flow, you're taken to the Checklist page so that you can manage and monitor the tasks and other parameters within the flow.