Build an automation that reads data from the queue and calculates the employee bonus. Test and run the automation from Bot editor on developer's device using actual queue data.

Understand how to use the Run with queue option from Bot editor. For more information, see Test and run WLM automation on developer device.

Prerequisites

  • Before you start building the automation, create an Excel file with the below data in your local folder.
    Employee ID Employee Name Salary Performance Rating Bonus
    E001 Alice Johnson 55000 4.5 0.1
    E002 Rajesh Kumar 72000 3.8 0.08
    E003 Maria Lopez 48000 4.2 0.09
    E004 David Smith 95000 4.9 0.12
    E005 Anita Sharma 60000 3.5 0.07
  • Create a queue as Employee-Bonus-Queue. For more details, see Create standard queues and Example of configuring a queue.
  • Create a number variable, n_Final_Bonus.
  • Ensure that the role assigned to your Bot Creator user is added as a queue consumer (role). It ensures the availability of queues for selection while using Run with queue option to test and run WLM automation.

Procedure

  1. Create an automation as wlm-docs-BotEditor.
    1. On the left panel, click Automation.
    2. Click + Create > Task Bot.
    3. In the Create Task Bot window, enter the automation name.
    4. Accept the default folder location: \Bots\.
      To change the default storage location, click Choose and follow the prompts.
    5. Click Create and edit.
      Note: The default maximum size for individual Task Bot is 50 MB.
  2. Build the automation using the following actions.
    1. Message Box: Display a message indicating which employee record is being processed.
      Processing bonus for $workItem{"Employee Name"}$
    2. Number- Assign: Calculate the bonus using the formula.
      $workItem{Salary}.String:toNumber$ * $workItem{"Performance Rating"}.String:toNumber$*$workItem{Bonus}.String:toNumber$
      
    3. Message Box: Display the calculated bonus for the employee.
      Final bonus for $workItem{"Employee Name"}$ is $n_Final_Bonus.Number:toString$
      
    4. String- Assign: Store the final bonus result in a string variable.
       Final bonus for $workItem{"Employee Name"}$ is $n_Final_Bonus.Number:toString$
      
    5. Click Save.
  3. Click the three dots icon in Bot editor and click Work item template.
    1. Select the Employee-Bonus-Queue-docstest template and assign it to the automation. For more details, see Attach work item template to bot.
    2. Click Return to editor.
  4. Click Run > Run with queue to test and run the queue with queue items.

    The automation is moved into a queue to test the queue data and displays final bonus amount for each employee in the Work item result column of queue.

    See the following video to run a WLM automation with a queue from Bot editor.