I have multiple pdf they are coming dynamically. I have an idea in my mind:
- Take the pdf details into excel like pdf names and full path and read the excel and take the data into data table variable - dtData
- Upload all the pdf in storage bucket using foreach loop (dtData).
- Use create form task to create task for each pdf and display pdf in orc action center with approve and reject button for each within the same loop.
- Based on the user decision from orc action center, move/send the only approved pdfs to customer. Rejected PDFs will be ignored.
I’m not sure how and when to use Wait for Form Task and Resume activity?
Note: Please note I’m using RE framework.
I would really appreciate if you could help me out.
@Nitya1 Thanks for your reply. Here is a quick question.
If I use Create Form Task activity to create a task for each PDF within the foreach loop and display it in the Action Center then it will create taskID each time for the each pdf as output. Let say if we have 10 pdfs then loop will run 10 times and it will create 10 tasks in the action center and each time it will generate new taskID.
Later when we use the Wait for Form Task activity then are you saying to pass the taskID here which was generated last time?
then in this case it will take the reference of the last pdf. If user approves/rejects the rest of the previous pdf then how the Wait for Form Task activity will understand which job to resume?
To handle this situation, you need to ensure that you store and associate the task IDs of each PDF with their respective processing steps in your workflow. One way to achieve this is by using a dictionary or another suitable data structure to map the PDF file or some unique identifier to its corresponding task ID.
Then, when using the Wait for Form Task activity, you would need to pass the task ID associated with the PDF you are currently processing in the foreach loop. This ensures that the workflow waits for the specific task related to that PDF to be completed before moving on to the next iteration of the loop.
@Nitya1 I think you did not get my question yet.
What I wanted to ask
Let’s say if I’m processing 10 pdf at a time which will create 10 different task for user in orc Action Center.
10 different pdf will have 10 different task IDs so how to pass the 10 different task IDs to “Wait for Form Task and Resume” ?
I may have two options:
Pass the entire collection of task IDs but “Wait for Form Task and Resume” activity does not support passing an entire collection of task IDs as input.
One approach to handling multiple tasks would be to use a loop, such as a “For Each” loop, to iterate through the collection of task IDs. Inside the loop, you can use the “Wait for Form Task and Resume” activity and pass the current task ID as input. After each iteration, you can process the response and handle the approval or rejection accordingly.
But using a loop with the “Wait for Form Task and Resume” activity would cause the workflow to wait for each task individually, preventing further iterations.
And user may approve or reject one after another from orc Action Centre.
Edit: One other possibility is to use a Parallel For Each activity instead of a regular For Each. A Parallel For Each Activity with the Create From and Wait for Form Task and Resume activities inside would allow multiple tasks to be created from one job. As and when a task is completed, the same job will resume and be suspended again if there are other tasks still pending for that job. The job will only be completed once all tasks created from it have been completed.
Original post: What you actually need is one job to be triggered per PDF file, so that when a task is created in Action Center it can be traced back to one job only (as opposed to one job, multiple tasks).
Since you’re using REFramework, you can build a dispatcher bot and a performer bot plus an Orchestrator Queue. Build one robot to create a queue item for each PDF file that requires processing (e.g. a link or path to where the PDF file is located). Then have another robot that picks up one queue item, does the necessary processing, then creates the task and waits for it to complete. That way you can ensure that one PDF file = one job.
You have two options
- Use parallel for each and use wait for resume task.Check below for best practices
- Else after create task a tivity get the task object and from that get the task id and add it to aseparate queue and create a separate process which uses get task data activity which will check for completion of tasks and if completed will process it
Hope this helps
thanks lot @Anil_G and @yikwen.goo
I think I have got my answer but will post you once it is done. Just two questions from you @Anil_G.
- Are you suggesting the same flow which @yikwen.goo has suggested as below?
or I can keep simple for each loop for Create Form Task activity to create a task and collect the task id by doing add to collection and use a separate parallel for each activity where I can put “Wait for Form Task and Resume” activity to wait and resume the task by iterating the previously collected task id ?
- This question is out of topic but it would be really great if you could answer it.
As I’m using RE framework so flow does not allow me to keep “Create Form Task activity” and "Wait for Form Task and Resume” in one single module which is other than Main.xml. So, do I need to keep “Create Form Task activity” in the process module and "Wait for Form Task and Resume” in the Main.xml module?
If you’re using REF and integrating with Action Center you will likely come across other issues with non-serializable variable types because the REF contains variables like DataTable and DataRow. Facing Serializing Error in DU Framework waitforDataValidationActionResume - Feedback / Studio - UiPath Community Forum
Hi the issue has been resolved. I have converted data table into the array . Now looping through array. Meanwhile i have downgraded my packages versions. It is working fine