activities
latest
false
Workflow Activities
Last updated Oct 31, 2024

Sample Workflows

The Snippets panel in UiPath Studio stores XAML files added by users. The sample XAML files are stored in folders. The folder that stores XAML files used in long-running workflows is called Orchestration.

The sample XAML files are read-only. You need to create a separate Process in Studio, where you replicate the activities and configurations found in the snippets.

These snippets represent sample workflows created with the activities available in the Persistence activity package.

Prerequisites

  • To develop long-running workflows, based on the workflows in the Snippets panel, you need to have the UiPath.Persistence.Activities package installed.
  • We recommend using the Orchestration Process template to start building long-running workflows.

Add Queue Item and Wait till completion

This snippet creates a Queue Item and suspends the workflow until the processing of that Queue Item is completed.

  1. Drag an Add Queue Item And Get Reference activity into your workflow.

    This activity adds a Queue Item into a Queue container located in Orchestrator, using In/Out parameters. Then it retrieves the corresponding data about the newly created Queue Item Object into a QueueItemData type variable, in order to suspend the workflow, until the Queue Item is added into the Queue. See the Add Queue Item And Get Reference page for more information about the activity.
    When the Queue Items are added to the Orchestrator Queue, all QueueItemData type variables will be populated with the data retrieved from Orchestrator.
    1. In the Item Information collection, create a parameter with the Direction In/Out and set the value as a variable that you want to pass as a Queue Item. For this example, pass a String variable named Test.
    2. In the QueueItemObject(Output) property field, press CTRL + k on your keyboard and create a QueueItemData type variable, to store the data about the queue item, after it was created in Orchestrator. For this example, create a QueueItemData variable named QueueItemObject.


  2. Drag any activities that you want to run before the workflow is suspended to retrieve data about the queue item. In this snippet, the Any steps to be executed before suspending the workflow section is commented out, acting as a container inside which you can place activities that won't be executed at runtime.
  3. Drag a Wait For Queue Item And Resume activity into your workflow.

    This activity waits for a Queue Item to be added and processed in Orchestrator, in order to retrieve data about it and map it back into the workflow, inside the QueueItemData type variables. See the Wait For Queue Item And Resume page for more information about the activity.
    1. In the Queue Item Object (Input) property field, pass the QueueItemObject variable, to reference the exact queue item that you wanted to add to Orchestrator.
    2. In the Queue Item Object (Output) property field, press CTRL + k on your keyboard and create a QueueItemData type variable to store the data about the queue item after it was processed and retrieved.
  4. Add a Write Line activity into your workflow, to print out the Queue Item that you added in Orchestrator. For this example, in the Text property field, pass the Test variable.

Create External Task and Suspend till completion

This snippet creates an External Action and suspends the workflow until the user completes the action.

  1. Drag a Create External Task activity into your workflow.

    This activity creates an External Action in Action Center with the given Task Title, Task Priority, Task Catalog (now called Action Catalog) and Task Data. See the Create External Task page for more information about the activity.

  2. Populate the TaskDataCollection property window with arguments that pass information In, Out, or In/Out. For this example, create three arguments, each of them with a different Direction: In, Out, and In/Out. Set the Type as String. For the Value field, press CTRL + K on you keyboard and create three variables, that either give information (for In type arguments), or extract information ( for Out type arguments).

    For this example, create three String type variables:

    • InVariable - the Value of the argument of type In.
    • OutVariable - the Value of the argument of type Out.
    • InOutVariable - the Value of the argument of type In/Out.


      In the Task Object (Output) property field, press CTRL + k on your keyboard and create an ExternalTaskData type variable. For this example, name the variable TaskPersistData. This ExternalTaskData object is used to pass data from Orchestrator, in order to let the Robot know that until a specific Action task is completed, the workflow is suspended.
  3. Add any activities that you want to run before the workflow is suspended to retrieve data about the ExternalTaskData object.
    1. For this example, drag and drop a Sequence activity into your workflow and populate with three Write Line activities. Each Write Line activity is meant to output the data of the three variables passed in the External Task. Pass the following values in the Text property fields: InVariable, OutVariable, InOutVariable.
  4. Drag a Wait For External Task and Resume activity into your workflow.

    This activity suspends the workflow until an External Task is completed, and then maps it back into the workflow, inside the ExternalTaskData type variables. See the Wait For External Task And Resume page to learn more about this activity.
    1. In the Task Object (Input) property field, pass the ExternalTaskData variable, to reference the exact External Task that you created. For this example, pass the TaskPersistData variable.
    2. In the Task Action property field, press CTRL + k on your keyboard and create a String type variable and name it TaskAction. This stores the action taken by the user to complete the task.
    3. In the Task Object (Output) property field, press CTRL + k on your keyboard and create anExternalTaskData type variable and name it TaskData. This variable stores the updated Task object retrieved from Orchestrator after the completion of the External Action.
  5. Add any activities that you want to run after the workflow is resumed. For this example, print in the Output panel all the values retrieved after the completion of the External Action, using four Write Line activities. Pass the following variables in the Text fields: TaskAction, InVariable, OutVariable, InOutVariable.


Create Form Task and Suspend till completion

This snippet creates a Form Action and suspends the workflow until the user completes the Action.

  1. Drag a Create Form Task activity into your workflow.

    This activity creates a Form Action in Action Center with the given Task Title, Task Priority, Task Catalog (now called Action Catalog) and Task Data. See the Create Form Task page for more information about the activity.

  2. Populate the Task Data Collection property window with arguments that pass information In, Out, or In/Out. For this example, create three arguments, each of them with a different Direction: In, Out, and In/Out. Set the Type as String. For the Value field, press CTRL + K on you keyboard and create three variables that either give information (for In type arguments) or extract information ( for Out type arguments).

    For this example, create three String type variables:

    • InVariable - the Value of the argument of type In.
    • OutVariable - the Value of the argument of type Out.
    • InOutVariable - the Value of the argument of type In/Out.


      In the Task Object (Output) property field, press CTRL + k on your keyboard and create a FormTaskData type variable. For this example, name the variable TaskPersistData. This FormTaskData object is used to pass data from Orchestrator, in order to let the Robot know that until a specific Action task is completed, the workflow is suspended.
  3. Add any activities that you want to run before the workflow is suspended to retrieve data about the FormTaskData object. For this example, drag and drop a Sequence activity into your workflow and populate it with three Write Line activities. Each Write Line activity is meant to output the data of the three variables passed in the External Action. Pass the following values in the Text property fields: InVariable, OutVariable, InOutVariable.
  4. Drag a Wait For External Task and Resume activity into your workflow.

    This activity suspends the workflow until a Form Action is completed, and then maps it back into the workflow, inside the FormTaskData type variables.
    1. In the Task Object (Input) property field, pass the FormTaskData variable, to reference the exact Form Task that you created in Action Center. For this example, pass the TaskPersistData variable.
    2. In the Task Action property field, press CTRL + k on your keyboard and create a String type variable and name it TaskAction. This stores the action taken by the user to complete the task.
    3. In the Task Object (Output) property field, press CTRL + k on your keyboard and create a FormTaskData type variable and name it TaskData. This variable stores the updated Task object retrieved from Orchestrator after the completion of the task.
  5. Drag any activities that you want to run after the workflow is resumed. For this example, pass in the Output panel all the values retrieved after the completion of the External Action, using four Write Line activities. Pass the following variables in the Text fields: TaskAction, InVariable, OutVariable, InOutVariable.

Create Task and Assign to User

This snippet creates two External Actions, assigns them to a user, and displays a list of the failed action assignments.

  1. Drag two Create External Task activities into your workflow.

    1. For the first activity, give the action a title and set its priority. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create an ExternalTaskData type variable. For this example, name it Task1PersistData.
    2. For the second activity, give the action a title and set its priority. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create an ExternalTaskData type variable. For this example, name it Task2PersistData.


  2. Drag two Add To Collection activities into your workflow.

    Note:

    The Add To Collection activity is a Classic activity.

    To make the Add To Collection activity available in your project:

    • Have System.Activities package 22.4.1 or lower installed.
    • Go to the Activities panel.
    • Click the View Options docs image icon.
    • Click Show Classic.

    The activity can be found under Default Activities > Programming > Collection.

    1. In the Collection property fields, press CTRL + k on your keyboard and create a List<TaskUserAssignment> type variable and name it TaskAssignementsInput. Go to the Variables panel and initialize the variable in the Default field as new List(Of TaskUserAssignment.
    2. In the Item property field, create an instance of TaskUserAssignment, that has the following parameters: the ExternalTaskData variable and the email address of the user you want to assign the task to.

      For this example, type in the following:

      • Thenew TaskUserAssignment(Task1PersistData.Id, "emailaddress") expression for the first Add To Collection activity
      • The new TaskUserAssignment(Task2PersistData.Id, "emailaddress") expression for the second Add To Collection activity.


    3. Set the TypeArgument property as System.Collections.Generic.List<UiPath.Persistence.Activities.Tasks.TaskUserAssignment>.
  3. Drag an Assign Tasks activity into your workflow.

    1. In the TaskUserAssignments (Input) property field, pass the List<TaskUserAssignment> variable. For this example, pass the TaskAssignmentsInput variable.
    2. In the Task Assignment Type property field, type in the exact assignment operation that you want to perform: Assign or Reassign. For this example, type in Assign.
    3. In the FailedTaskAssignments (Output) property field, press CTRL + k on your keyboard and create a List<TaskAssignmentResponse> type variable and name it FailedTaskAssignmentsOutput.


  4. Drag a Write Line activity, to output the number of failed task assignments. In the Text property field, pass the List<TaskAssignmentResponse> type variable, then use the .Count and .ToString properties. For this example, pass the following expression: FailedTaskAssignemntsOutput.Count.ToString.

Start Job and Resume After Completion

Starts an unattended process and suspends the workflow until a particular job is completed.

  1. Drag a Start Job And Get Reference activity into your workflow.

    This activity starts a Job in Orchestrator, based on the arguments inputted, and then retrieves the corresponding Job Object. See the Start Job And Get Reference page for more information about the activity.

    1. In the ProcessName property field, pass the Display name of the Process that you want to use for the Job. For this example, store the name inside a variable. Press CTRL +k on your keyboard and create a String type variable and name it ProcessName. In the Value field, pass the Display name of the Process, for example, TestProcess_test.
      Note: The Display name needs to be written in the following format: packageName _environment.


    2. In the Job Arguments (Collection) property, create the arguments that you want to use when invoking the job in Orchestrator. This property modifies the Out and In/Out type of arguments based on the input received from the Job in Orchestrator, and then maps them back into the workflow. For this example, create a String Type argument, named Test, of Direction In/Out. In the Value field, press CTRL + k on your keyboard and create a String type variable. Name the variable Test.


    3. In the Job Object (Output) property field, press CTRL + k on your keyboard and create a JobData type variable, named JobPersistenceData. This variable stores the Job Data Object created when the Job in Orchestrator is invoked, in order to use it for the Wait for Job and Resume activity.
  2. Add any activities that you want to run before the workflow is suspended to retrieve data about the JobData object.
  3. Drag a Wait for Job and Resume activity into your workflow.

    This activity suspends the workflow until a specific Job in Orchestrator is completed. After the Job is completed, the workflow is resumed.

    1. In the Job Object (Input) property field, pass the JobData type variable, created for the Start Job And Get Reference activity. For this example, pass the JobPersistenceData variable. This points the Robot to the exact Job that needs to be completed until the workflow is resumed.
    2. In the Job Object (Output) property field, press CTRL + k on your keyboard and create a JobData type variable. For this example, name it JobDataObject.
  4. Drag a Write Line activity, in order to print out the argument that has been mapped back into the workflow. In the Text property field, pass the variable used as the Value for the argument created in the Job Arguments (Collection). For this example, pass the Test variable.

Suspend and Resume after 1 hour

This snippet suspends the given workflow and resumes it after one hour.

  1. Add any activities that you want to run before the workflow is suspended.
  2. Drag a Resume After Delay activity into your workflow. This activity suspends the given workflow and resumes it at a specified date and time.

    See the Resume After Delay page to learn more about this activity.

    1. 2.1. In the Variables panel, create a System.TimeSpan type variable. For this example, name the variable OneHour. Set the Default value of the TimeSpan variable as New TimeSpan(1,0,0).
    2. 2.2. In the Resume Time property field of the activity, pass the DateTime.Now expression and the TimeSpan variable. For this example, pass the following expression: DateTime.Now + OneHour.


  3. Add any activities that you want to run after the workflow is resumed.

Suspend and Resume After 5 Minutes

This snippet suspends the given workflow and resumes it after five minutes.

  1. Drag any activities that you want to run before the workflow is suspended.
  2. Drag a Resume After Delay activity into your workflow. This activity suspends the given workflow and resumes it at a specified date and time.

    1. In the Variables panel, create a System.TimeSpan type variable. For this example, name the variable FiveMinute. Set the Default value of the TimeSpan variable as New TimeSpan(0,5,0).
    2. In the Resume Time property field of the activity, pass the DateTime.Now expression and the TimeSpan variable. For this example, pass the following expression: DateTime.Now + FiveMinute.


  3. Drag any activities that you want to run after the workflow is resumed.

Suspend and Resume After 90 Seconds

This snippet suspends the given workflow and resumes it after ninety seconds.

  1. Add any activities that you want to run before the workflow is suspended.
  2. Drag a Resume After Delay activity into your workflow. This activity suspends the given workflow and resumes it at a specified date and time.

    1. In the Variables panel, create a System.TimeSpan type variable. For this example, name the variable NinetySeconds. Set the Default value of the TimeSpan variable as New TimeSpan(0,0,90).
    2. In the Resume Time property field of the activity, pass the DateTime.Now expression and the TimeSpan variable. For this example, pass the following expression: DateTime.Now + NinetySeconds.


  3. Drag any activities that you want to run after the workflow is resumed.

Wait For All Form Tasks Completion

This snippet creates multiple Form Actions in a loop, based on the number of invoices in a data table, and suspends the workflow until all the actions are completed.

  1. Drag a BuildDataTable activity into your workflow.

    1. In the Output property field, press CTRL + k on your keyboard and create a DataTable type variable, to store the data table that you are building. For this example, name the DataTable variable as HighValueInvoices.
    2. Click . The Build Data Table window opens.

    3. Rename Column1 as InvoiceNumber and Column2 as InvoiceAmount.
    4. Add data inside the rows of the table and press OK.



  2. Drag an Assign activity into your workflow. This acitivity assigns a name for the Data Table, stored in a String variable.
    1. In the To property field, pass the DataTable variable. For this example, pass the HighValueInvoices variable.
    2. In the Value property field, press CTRL + k on your keyboard and create a String type variable. For this example, name it DataTableName. Set the Default value of the DataTableName variable as ``"invoices"`.
  3. Drag a For Each activity into your workflow. In the List of items property field, pass an expression with the following format: DataTableVariable.Rows. For this example, pass HighValueInvoices.Rows. This iterates through every row in the data table.
  4. Drag a Create Form Task activity inside the Body of the For Each activity.

    1. In the Task Title property field, input the Invoice Number value that the For Each activity retrieves and convert it to String. For this example, input the following expression: item("InvoiceNumber").ToString, where InvoiceNumber is the name of the column holding the respective number for each invoice.
    2. In the Form Data (Collection), create an argument that passes each invoice amount inside the Form Action. Create a String Type argument and set the Direction as In. In the Value field, input each invoice amount and convert them to String. For this example, input the following expression: item("InvoiceAmount").ToString, where InvoiceAmount is the name of the column holding the respective amount for each invoice.
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData type variable. For this example, name the variable as TaskPersistData.


  5. Drag an Add To Collection activity inside the Body of the For Each activity.

    1. In the Collection property field, press CTRL + k on your keyboard and create a List<FormTaskData> variable and name it TaskList. Go to the Variables panel and initialize the variable in the Default field as New List(Of UiPath.Persistence.Activities.FormTask.FormTaskData.
    2. In the Item property field pass the FormTaskData variable, created to store the data on the Form Actions created. For this example, pass the TaskPersistData variable.
    3. For the TypeArgument property, choose UiPath.Persistence.Activities.FormTask.FormTaskData.
  6. Drag a Parallel For Each activity into your workflow.

    1. For the TypeArgument property, choose UiPath.Persistence.Activities.FormTask.FormTaskData.
    2. In the Values property field, pass the List<FormTaskData> variable. For this example, pass the TaskList variable.
  7. Drag a Wait for Form Task and Resume activity into the body of the Parallel For Each activity.

    1. In the TaskObject(Input) property field, input the item object, referenced in the Parallel For Each activity. In this case, the item object represents the Form Actions stored in the TaskList variable.
    2. In the TaskAction property field, press CTRL + k on your keyboard and create a String variable. For this example, name it TaskAction.
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name it TaskData.


  8. Drag a Write Line activity into your workflow. This activity displays in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction variable.

Wait for Any Form Task Completion

This snippet creates multiple Form Actions in sequence and suspends the workflow until any of the Form Actions is completed.

  1. Drag a Create Form Task activity into your sequence workflow.

    1. In the TaskTitle property field, press CTRL + k on your keyboard and create a String variable. Name it TaskTitle1. In the Variables panel, set the Default value as "Task - " + "Approver 1".
    2. In the FormData(Collection) property, create an argument of Type String and Direction In. Name the argument Approver and set the Value as "Approver1".
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name the variable TaskPersistData1.
  2. Drag a second Create Form Task activity into your workflow.

    1. In the TaskTitle property field, press CTRL + k on your keyboard and create a String variable. Name it TaskTitle2. In the Variables panel, set the Default value as "Task - " + "Approver 2".
    2. In the FormData(Collection) property, create an argument of Type String and Direction In. Name the argument Approver and set the Value as "Approver2".
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name the variable TaskPersistData2.
  3. Drag a third Create Form Task activity into your workflow.

    1. In the TaskTitle property field, press CTRL + k on your keyboard and create a String variable. Name it TaskTitle3. In the Variables panel, set the Default value as "Task - " + "Approver 3".
    2. In the FormData(Collection) property, create an argument of Type String and Direction In. Name the argument Approver and set the Value as "Approver3".
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name the variable TaskPersistData3.
  4. Drag a Pick activity into your workflow.
  5. Drag a Pick Branch activity into the body of the Pick activity. Rename the activity as Pick Branch (Task1).
  6. Drag a Wait For Form Task And Resume activity into the Trigger body of the Pick Branch (Task1) activity.
    1. In the TaskObject (Input) property field, pass the FormTaskData variable created to store data about the Form Action. For this example, pass the TaskPersistData1 variable.
    2. In the TaskAction property field, press CTRL + k and create a String variable. Name it TaskAction1.
    3. In the TaskObject(Output) property field, press CTRL+ k on your keyboard and create a FormTaskData variable. Name it TaskData1.
  7. Drag a Write Line activity into the Action body of the Pick Branch (Task1) activity. This activity is meant to display in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction1 variable.


  8. Drag a Pick Branch activity into the body of the Pick activity. Rename the activity as Pick Branch (Task2).
  9. Drag a Wait For Form Task And Resume activity into the Trigger body of the Pick Branch (Task2) activity.
    1. In the TaskObject (Input) property field, pass the FormTaskData variable created to store data about the Form Action. For this example, pass the TaskPersistData2 variable.
    2. In the TaskAction property field, press CTRL + k and create a String variable. Name it TaskAction2.
    3. In the TaskObject(Output) property field, press CTRL+ k on your keyboard and create a FormTaskData variable. Name it TaskData2.
  10. Drag a Write Line activity into the Action body of the Pick Branch (Task2) activity. This activity displays in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction2 variable.
  11. Drag a Pick Branch activity into the body of the Pick activity. Rename the activity as Pick Branch (Task3).
  12. Drag a Wait For Form Task And Resume activity into the Trigger body of the Pick Branch (Task3) activity.
    1. In the TaskObject (Input) property field, pass the FormTaskData variable created to store data about the Form Action. For this example, pass the TaskPersistData3 variable.
    2. In the TaskAction property field, press CTRL + k and create a String variable. Name it TaskAction3.
    3. In the TaskObject(Output) property field, press CTRL+ k on your keyboard and create a FormTaskData variable. Name it TaskData3.
  13. Drag a Write Line activity into the Action body of the Pick Branch (Task3) activity. This activity displays in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction3 variable.

Wait For Some Form Tasks Completion in Loop

This snippet creates multiple Form Actions, based on input from a Data Table, and suspends the workflow until a certain set of Form Actions are completed.

  1. Drag a Build Data Table activity into your workflow.

    1. In the DataTable property field, press CTRL + k on your keyboard and create a System.DataTable variable. For this example, name it CodeReviews.
    2. Click . The Build Data Table window opens.

    3. Rename Column1 as ReviewerName and Column2 as ReviewerType. Set the Type of the ReviewerType column to String.
    4. Add data inside the rows of the table. For the ReviewerType column, this example uses two types of reviewers: code owners and reviewers.


  2. Drag an Assign activity into your workflow. This assigns a name to the data table you created. In the To property field, pass the System.DataTable variable and add .TableName property to it. In the Value field, press CTRL + k on your keyboard and create a String variable. For this example, name it DataTableName.
  3. Drag a Parallel For Each activity into your workflow. For this example, name it Create Tasks for PR Review.
    1. In the Values property field, pass the System.DataTable variable and add the property .AsEnumerable. For this example, pass the following expression: CodeReviews.AsEnumerable.
  4. Drag an Assign activity in the Body of the Parallel For Each activity.

    1. In the To property field, press CTRL + k on your keyboard and create a String variable, that holds the data retrieved from the ReviewerType column in the CodeReviews data table. For this example, name the variable ReviewerType.
    2. In the Value property field, pass an expression that retrieves each row item from the ReviewerType column and stores it in the variable created inside the To field. For this example, pass the following expression: ìtem("ReviewerType").toString.


  5. Drag a Create Form Task activity into the Body of the Parallel For Each activity.

    1. In the TaskTitle property field, pass the following expression: "Code Review - " + InPullRequestName. The InPullRequestName is a String variable, that has the Default value "#1".
    2. In the FormData(Collection) property, create four arguments of Type String:
    3. 'PR Number' - with the Direction In, and the Value set as the InPullRequestName.
    4. Reviewer Name - with the Direction In, and the Value set as item("ReviewerName").toString.
    5. Reviewer Type - with the Direction In/Out, and the value set as the ReviewerType variable.
    6. Reviewer Comment - with the Direction Out. In the Value field, press CTRL + k on your keyboard and create a String variable. Name it ReviewerComments. This argument maps into the workflow whatever comments are made in the Action.
      5.3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. Name it TaskPersistData.


  6. Drag an Add To Collection activity into the body of the Parallel For Each activity. This activity stores all the Form Actions created into a list.

    1. In the Collection property field, press CTRL + k on your keyboard and create a List<FormTaskData> variable. Name it TaskDataList. Go to the Variables panel and set the Default value of the variable as New List(of UiPath.Persistence.Activities.FormTask.FormTaskData).
    2. In the Item property field, pass the FormTaskData variable. For this example, pass the TaskPersistData variable.
    3. For the TypeArgument property, choose UiPath.Persistence.Activities.FormTask.FormTaskData.
  7. In the Variables panel, create two variables of type Int32 and set their Default value to 0: OwnersApprovals and ReviewersApprovals.
  8. Drag another Parallel For Each activity. For this example, name it Wait for Conditional Task(s) Completion.
    1. In the Condition property field, pass the following expression: OwnersApprovals>=2 Or (OwnersApprovals = 1 And ReviewersApprovals>=2). This conditions the workflow to resume only when the condition is met.
    2. For the TypeArgument property, choose UiPath.Persistence.Activities.FormTask.FormTaskData.
    3. In the Value property field, pass the list where the Form Actions are stored. For this example, pass the TaskDataList variable.


  9. Drag a Sequence activity into the Body of the Wait For Conditional Task(s) Completion activity. Rename it Wait for Task and Resume.
  10. Drag a Wait For Form Task And Resume activity into the Wait for Task and Resume sequence activity.

    1. In the TaskObject(Input) property field, pass the item variable.
    2. In the TaskAction property field press CTRL + k on your keyboard and create a String variable. For this example, name it TaskAction.
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name it TaskData.
  11. Drag an If activity into the Wait for Task and Resume sequence activity. This activity is meant to count the number of Form Actions that have been approved by code owners.

    1. In the Condition property field pass the following expression: TaskAction="approve" And ReviewerType="code owner".
    2. Drag and drop an Assign activity in the Then block. In the To property field, pass the OwnersApprovals variable. In the Value property field pass the OwnersApprovals + 1 expression.


  12. Drag another If activity into the Wait for Task and Resume sequence activity. This activity is meant to count the number of Form Actions that have been approved by reviewers.

    1. In the Condition property field pass the following expression: TaskAction="approve" And ReviewerType="reviewer".
    2. Drag an Assign activity in the Then block. In the To property field, pass the ReviewersApprovals variable. In the Value property field pass the ReviewersApprovals + 1 expression.


  13. Drag three Write Line activity into the Wait for Task and Resume sequence activity. This activity displays the given values in the Output panel.

    1. In the first activity, pass the ReviewComments variable.
    2. In the second activity, pass the OwnersApprovals variable and add the .toString property.
    3. In the third activity, pass the ReviewersApprovals variable and add the .toString property.

Wait For Some Form Tasks Completion

This snippet creates three Form Actions and suspends the workflow until two Actions are completed.

  1. Drag a Create Form Task activity into your sequence workflow.

    1. In the TaskTitle property field, press CTRL + k on your keyboard and create a String variable. Name it TaskTitle1. In the Variables panel, set the Default value as "Task - " + "Approver 1".
    2. In the FormData(Collection) property, create an argument of Type String and Direction In. Name the argument Approver and set the Value as "Approver1".
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name the variable TaskPersistData1.
  2. Drag a Create Form Activity into your sequence workflow.

    1. In the TaskTitle property field, press CTRL + k on your keyboard and create a String variable. Name it TaskTitle2. In the Variables panel, set the Default value as "Task - " + "Approver 2".
    2. In the FormData(Collection) property, create an argument of Type String and Direction In. Name the argument Approver and set the Value as "Approver2".
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name the variable TaskPersistData2.
  3. Drag a Create Form Activity into your sequence workflow.

    1. In the TaskTitle property field, press CTRL + k on your keyboard and create a String variable. Name it TaskTitle3. In the Variables panel, set the Default value as "Task - " + "Approver 3".
    2. In the FormData(Collection) property, create an argument of Type String and Direction In. Name the argument Approver and set the Value as "Approver3".
    3. In the TaskObject(Output) property field, press CTRL + k on your keyboard and create a FormTaskData variable. For this example, name the variable TaskPersistData3.
  4. Drag a Parallel activity into your workflow.

    1. In the Condition property field, press CTRL + k on your keyboard and create a Int32 variable. For this example, name the variable CompleteTasksCount and set the Default value to 0.
    2. In the Expression Editor inside the Condition property, set the condition as CompleteTasksCount=2. This conditions the Parallel activity to complete when two out of the three actions are completed.


  5. Drag a Sequence activity into the body of the Parallel activity. Rename the activity as Sequence Task1.
  6. In the Sequence Task1 activity, drag a Wait For Form Task and Resume activity. Rename it as Wait for Form Task and Resume(Task1).
    1. In the TaskObject (Input) property field, pass the FormTaskData variable created to store data about the Form Action. For this example, pass the TaskPersistData1 variable.
    2. In the TaskAction property field, press CTRL + k and create a String variable. Name it TaskAction1.
    3. In the TaskObject(Output) property field, press CTRL+ k on your keyboard and create a FormTaskData variable. Name it TaskData1.


  7. Drag a Write Line activity into the Action body of the Sequence Task1 activity. his activity is meant to display in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction1 variable.
  8. Drag an Assign activity in the Wait for Form Task and Resume(Task1) activity. Pass the CompleteTaskCount in the To field and the CompleteTaskCount + 1 expression in the Value field. If the action is completed and the workflow is resumed, then a new iteration is added to the CompleteTaskCount variable.


  9. Drag a Sequence activity into the body of the Parallel activity. Rename the activity as Sequence Task2.
  10. In the Sequence Task2 activity, drag and drop a Wait For Form Task and Resume activity. Rename it as Wait for Form Task and Resume(Task2)
    1. In the TaskObject (Input) property field, pass the FormTaskData variable created to store data about the Form Action. For this example, pass the TaskPersistData2variable.
    2. In the TaskAction property field, press CTRL + kand create a String variable. Name it TaskAction2
    3. In the TaskObject(Output) property field, press CTRL+ k on your keyboard and create a FormTaskData variable. Name it TaskData2.
  11. Drag a Write Line activity into the body of the Sequence Task2 activity. This activity displays in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction2 variable.
  12. Drag an Assign activity in the Wait for Form Task and Resume(Task2)activity. Pass the CompleteTaskCountin the To field and the CompleteTaskCount + 1expression in the Value field. If the action is completed and the workflow is resumed, then a new iteration is added to theCompleteTaskCount variable.
  13. Drag a Sequence activity into the body of the Parallel activity. Rename the activity as Sequence Task3.
  14. In the Sequence Task3 activity, drag and drop a Wait For Form Task and Resume activity. Rename it as Wait for Form Task and Resume(Task3).
    1. In the TaskObject (Input) property field, pass the FormTaskData variable created to store data about the Form Action. For this example, pass the TaskPersistData3 variable.
    2. In the TaskAction property field, press CTRL + k and create a String variable. Name it TaskAction3.
    3. In the TaskObject(Output) property field, press CTRL+ k on your keyboard and create a FormTaskData variable. Name it TaskData3.
  15. Drag a Write Line activity into the Action body of the Sequence Task3 activity. his activity is meant to display in the Output panel the action taken by the user to complete the Form Action. In the Text value, input the TaskAction3 variable.
  16. Drag an Assign activity in the Wait for Form Task and Resume(Task3)activity. Pass the CompleteTaskCountin the To field and the CompleteTaskCount + 1expression in the **Value** field. If the action is completed and the workflow is resumed, then a new iteration is added to theCompleteTaskCount variable.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.