Managing a Human task from the UI
You can create a Human task using the UI to manage the acquisition of raw materials based on current market prices and user approval.
About this task
Michael, an HCL Universal Orchestrator user,
needs to automate the daily process of checking raw material prices and enabling a
designated user to approve purchases or sales. Steve, the materials manager, is the
authorized user who must review the prices and decide what action to take.
- Prerequisites
-
- Email notifications
- Micheal has enabled email notifications, as described in Enabling email notifications for Human Tasks.
DAILY_MATERIALS_ACQUIREMENTworkflow- Micheal has created a workflow named
DAILY_MATERIALS_ACQUIREMENTthat runs daily.
RETRIEVE_PRICEStaskDAILY_MATERIALS_ACQUIREMENTworkflow contains a JSONata task namedRETRIEVE_PRICESthat is aimed at retrieving prices by calling an API to get the current prices for gold and silver. The message that theRETRIEVE_PRICEStask gets from the API call has the following format:
In the Action section of the{ "goldPrice" : 20, "silverPrice": 10 }RETRIEVE_PRICES, under Queries, Micheal has added the following Key and Value inputs:- Key: goldprice; Value: goldPrice
- Key: silverprice; Value: silverPrice
- Gold and silver acquirement tasks
- Micheal has already created the four tasks that depend on
the decision taken by Steve after having interacted with the
Human task:
Buy_goldSell_goldBuy_silverSell_silver
- Procedure
-
Micheal now needs to create a Human task queue and a Human task to make Steve able to interact with the acquirement process. You can find the steps that Michel must perform for such purpose below:
Procedure
-
Create a queue named
/SteveQueue:- In the Graphical Designer page, from the Assets tab, click Add new.
- From the drop-down menu, select Human Task Queue.
-
In Name, type
SteveQueue. - In Folder, select a folder from the available items.
-
In Prefix, type
PRX. - Save.
-
Drag the
DAILY_MATERIALS_ACQUIREMENTworkflow into the canvas. -
Create a Human task template, named
TAKE_STEVE_INPUT:- In the Graphical Designer page, from the Assets tab, click Add new.
- From the drop-down menu, select Task template.
- In the Add new task template panel, expand the Human tasks section, then select Human Task and click Next.
-
In Name, type
TAKE_STEVE_INPUT. - In Workstation, select a workstation.
- In the Action section, in Title, type Decide raw materials acquirement.
-
In Queue, select
/SteveQueue. - In Assignee, select Steve.
-
Edit the
TAKE_STEVE_INPUTHuman task form to create input fields for Steve to specify the actions to take according to gold and silver daily prices: -
Set the output conditions for the
TAKE_STEVE_INPUTtask: - Click Add at the end of the Add new task template panel.
-
Drag the
TAKE_STEVE_INPUTHuman task into theDAILY_MATERIALS_ACQUIREMENTworkflow, then set RETRIEVE_PRICES as predecessor ofTAKE_STEVE_INPUTusing the arrows. -
Drag
Buy_gold,Sell_gold,Buy_silverandSell_silvertasks intoDAILY_MATERIALS_ACQUIREMENTworkflow. -
Set
TAKE_STEVE_INPUTas predecessor ofBuy_goldand selectBuy_goldfrom the output conditions drop-down menu. Then, repeat this step for all the other tasks:- On
Sell_goldtask, select theSell_goldoutput condition. - On
Buy_silvertask, select theBuy_silveroutput condition. - On
Sell_silvertask, select theSell_silveroutput condition.
- On
- Deploy the workspace.
Results
DAILY_MATERIALS_ACQUIREMENT
workflow runs, the RETRIEVE_PRICES task runs and fetches the daily
prices for gold and silver. At this point, the TAKE_STEVE_INPUT task
starts and Steve receives an email with a link to the assigned task. When Steve opens
the Human Task page on the UI, he sees the raw materials acquirement task waiting in
/SteveQueue. The form displays the current gold and silver prices,
and Steve fills out the form, selecting buy for gold and specifying the quantity; he
then selects Do nothing for silver, and confirms the form to
complete the task.At this point, the
TAKE_STEVE_INPUT task status
changes to Successful, and the
DAILY_MATERIALS_ACQUIREMENT workflow evaluates the output
conditions for the subsequent tasks. Consequently:- The
Buy_goldtask runs to perform the purchase that Steve approved.Note: To establish the quantity of gold to buy, theBuy_golduses thegold_quantityoutput property that was provided in the form of theTAKE_STEVE_INPUTHuman task:${jobs.TAKE_STEVE_INPUT.gold_quantity} - Neither
Buy_silverorSell_silvertasks start because their conditions were not met.