BulePrism进阶教程-9. Case Management

Almost every Blue Prism Process will make use of a work queue, which is essentially a list of jobs, or cases. New cases can be fed into the queue, and the queue can be updated with results as each case is worked.
A work queue provides the following features:
 Multiple machines can work from the same queue at the same time, each retrieving different cases to work.
 An individual case can be marked as “complete” if it has been worked satisfactorily, or marked as an “exception”, if it could not be completed.
 Queued work can be monitored and maintained from Control Room.
 MI such as volumes, performance levels, and exception details can be extracted from queue data.
A Blue Prism Process is intended to obey instruction to do a repetitive task. That instruction could be some kind of list feeding the Process with work, for example a spreadsheet. Alternatively, a Process might be designed to wait for work to appear on an ad hoc basis, for example files appearing in a folder.
Realistically we should expect there will be problems and accept that some cases will succeed and some will not. We may also instruct Blue Prism to purposely disregard certain cases. Whatever happens, we will need to record results.
If there are too many cases for one instance of Blue Prism to cope with, we may want to run the same Process on multiple machines to share out the workload.
The Work Queue feature provides this functionality to store, manage, share, and report on Process work.

9.1. Review
A work queue is an internal configurable list that enables a Process to manage its workload. A Process can use different work queues and a work queue can be shared by multiple Processes if required.
The Queue Management tab in Control Room provides the operational user interface for work queues. The tab is divided in two; a list of queues is shown in the upper half and the lower half shows a list of the items in a queue.
Exercise 9.1.1 Working Items
 Create a Process named Queue Exercises 1 and add a new Action stage.
 Open the Action properties and select Internal - Work Queues from the list of Business Objects.
Key Point
Blue Prism has some Business Objects that come as part of the software. These “internal” Business Objects are not diagrams and cannot be seen or changed, only used
Select Get Next Item from the list of actions and enter “Queue1” (remember the quotes!) as the Queue Name input parameter value.
 Select the Outputs tab to see the output values. Use the auto-generate buttons in the Store In column to create the output Data Items.

Figure 129: The Auto-generate Button in the Store In Column
 Tip: Data Items created like this are automatically given the same name and type as the output.
 “OK” the properties and rearrange the new Data Items on the page. Right-click on the End stage and select Breakpoint from the mouse menu.
 The diagram should now look something like this:

 Save the Process and run the page.
 Close the Breakpoint message when it appears but do not press the Reset button.
 Open the properties of the Data Items to see their current values.
Exercise 9.1.2 Completing Items
 Leave the Process at the Breakpoint and bring Control Room to the front.
 Refresh the screen, either by pressing the Refresh button, on the drop down menu , or the F5 key. Notice how the first item in Queue1 is now marked with a yellow lock icon,.
 Return to the diagram and pull the End stage down to make room for a new Action stage.
 Select the Internal - Work Queues Business Object as before, but now choose Mark Completed from the second drop-down list.
 Drag in one of your existing Data Items for the input value and press “OK”.
 Tip: Every item is given a unique ID consisting of a series of characters and numbers. This kind of ID is known as a Globally Unique Identifier or GUID.
 Your diagram should now look something like this:

Figure 131: Mark Completed
 Remove the Breakpoint from the End stage and right-click on the Mark Completed action.
 Select Set Next Stage from the mouse menu and then step through to the end of the Process.
 Go back to Control Room and refresh the Queue Management screen.
 See that the first item is now marked with a green check mark ().
Exercise 9.1.3 Exception Items
 Return to the Process and change the second Action stage to use Mark Exception instead of Mark Completed. Choose your own value for the Exception Reason input and enter False as the Retry input.
 Tip: Remember an input takes its value from the result of an expression, and in an expression text values must be written in quotes, “like this”. The value of a flag does not need to be written in quotes - it is either True or False.
 Run the Process again and then see how the next item in the queue has been marked with an exception icon, .
 Scroll to the right to see the Exception Reason column where you should see your input value.
Key Points
 In Control Room an unworked or pending item will be marked with three blue dots, like this: .
 Locked items are marked with a padlock, like this:.
 Completed items are marked with a green check mark, like this:.
 Exception items are marked with a purple flag, like this: .

Exercise 9.1.4 Locking Items
 Save the Process and then use Save As to create a copy named Queue Exercises 1a.
 Open the original process too so that you have two Process Studios open.
 Step through both Processes to show that when one Process has got an item, the other Process cannot get the same item because the queue has locked it.
Key Points
 The special “Work Queue – Internal” Business Object is used to interact with a work queue.
 When an item is being worked, it is “locked” so no-one else can work it.
 When an item is marked as “complete” or “exception”, the lock is released.
 An item is referred to by its unique Blue Prism ID.
 Each item has its own Collection to hold data.
9.2. Queue Items
A queue needs to be filled with items before it can be used and the work queue Business Object provides a way to add new items using a Collection. Here we will be using a collection as an input to an action, rather than as an output as we did previously.
Exercise 9.2.1 Adding New Items
 Start a new Process named “Queue Exercises 2”.
 Create a new Collection with columns matching the output Collection in the first Process. Add two fields named Account ID and Note Text so your collection properties look as follows:
Figure 132: Collection Fields
 Name the Collection New Items and complete a handful of new rows on the Initial Values tab. Type in what you like as the values.

Figure 133: Collection Initial Values
Key Point

 Link the Yes branch of the Decision to the Action stage.
 Like in a Data Item, the initial and current values of a Collection are not expressions and text values do not need quotes.
 Create a new Action stage that uses the Add to Queue action from the Internal - Work Queues Business Object.
 Enter “Queue1” (remember the quotes!) as the Queue Name input parameter and drag in your Collection as the Data input parameter. Leave the other input parameters blank for now.
 Link up the new Action stage and save the Process. It should look something like this:
Figure 134: Add to Queue
 Run the Process then go back to Control Room and see your new items added to the queue.
 Tip: Inputs and outputs can sometimes be optional and left blank.
As items get marked as “complete” or “exception”, the queue will eventually have nothing left available to work. The signal to a Process that the queue has nothing available is that the outputs from Get Next Item are returned empty.
Exercise 9.2.2 Working All Items
 Go back to the Queue Exercises 1a Process and add a decision after the Get Next Item.
 The easiest way to know if Get Next Item has got anything is to check the Item ID output. Use the expression [Item ID]<>”” in your Decision expression.
 Link the No branch to a new Anchor stage. The Anchor stage is an inert stage that has no effect on diagram logic. Its purpose is to join links together, either to redirect a link or create a long link.
Figure 135: Anchor Toolbar Button

Figure 136: Anchor Stage
 Link from the Anchor stage to the End stage so that your diagram looks something like this:

As you can see, the process contains a linked loop that returns the flow back up to Get Next Item after Mark Complete. To prevent the process going around this cycle forever (an infinite loop), we have used a Decision to stop when the queue has no more items available.
The Decision expression [Item ID]<>”” says in essence, “Have we got an item ID?” and if the answer is “Yes”, we know we have an item to work with. When the answer is “No”, we know there are no more items left to work and we redirect the flow to the end point.
 Arrange the desktop so you can see Process Studio and Queue Management.
 Run the process slowly and watch how it flows around the loop. Use the Refresh button, , on Queue Management to see the item statuses change.
 Tip: The Queue Management tree item in Control Room does not update automatically – refresh to see the latest picture.
Best Practice
 A Get Next Item Action should almost invariably be followed by some sort of Got Item? Decision.
 An expression checking if the ID is blank is the best way to test if you have got an item.
9.3. Work Queue Configuration
Work queues are created in System Manager, the administrative area of Blue Prism.

Figure 137: Work Queue Configuration
Exercise 9.3.1 Creating a Queue
 Go to System Manager and look at the Work Queue Configuration tab in the Workflow section.
 Create a new queue named Queue2 and name the Key Name Staff ID. Return to Control Room to see the new queue.
 Tip: Remember to use the Apply button to confirm your changes.
 Note: The Encrypted option is available to ensure any sensitive data held within the queue is encrypted in the Blue Prism database. Leave this option un-checked for this exercise.
Exercise 9.3.2 Populating a Queue
Modify the Queue Exercises 2 Process so that it can populate the new queue with five new items.
 Reset the Queue Exercises 2 Process and then inspect the properties of the New Items collection.
 Remove all the existing fields from the collection and then add the following fields. (Take care to spell “Staff ID” exactly as you did in the previous exercise.)


 Add five items to the initial values.
 Run the Process and check that your new queue has been populated. Note that the Staff ID values are in the Item Key column.
Exercise 9.3.3 Working a Queue
 Modify the Queue Exercises 1 to use the new queue. Mark the item as complete if the employee is full-time and mark part-timers as exceptions.
 Tip: Remember to use dot notation for Collections in expressions e.g., [Data.Full Time].
 Your diagram might look something like this:

Exercise 9.3.4 Creating a Narrative
We shall repeat the previous exercise but record some additional detail as we work each case.
 Open Queue Exercises 2 and add a new field to the Collection, name Narrative, data type Text. Leave the Narrative values blank.
 Run the process put some new items into Queue2, then save and close.
 Add Note stages to represent some imaginary steps into your Process – e.g.,“Locate Staff Member”, “Open Staff Record”, and “Read Working Hours”.
Figure 138: Note Stage Toolbar Button
Like the Anchor, a Note is an inert stage that has no effect on a Process or Business Object. Its purpose is to annotate diagrams.
Figure 139: Note Stage
Figure 140: Note Stage Properties
 After each Note, use a Calculation stage to modify the Narrative field in the Data collection.
 Tip: Think carefully about your Calculation stage. Would you prefer to replace the narrative or append to it?
 After each Calculation add an Action using the Set Data from the Internal - Work Queues Business Object to commit the change back to the queue.

 Tip: Think about how collecting this information could save your Process some time and think about who else might use the information and how.
Key Points
 The item data Collection can be updated to save information back to the queue.
 Providing empty fields (like Narrative) when the item is created could provide storage for data collected while the item is being worked.
9.4. Defer
New items can be deferred to prevent them from being worked too soon. If a deferral date is specified when items are created, the queue will hold on to them until that date. Effectively the items are temporarily frozen.
Exercise 9.4.1 Deferring New Items
 Open Queue Exercises 2 and add new items to Queue2 but this time set the Defer Until input to a future date.

 Return to Queue Exercises 1 and notice how Get Next Item returns nothing, as if the queue was empty. The queue will not release these items until the deferral date arrives.
Key Point
 If Get Next Item fails to get an item, it does not necessarily mean there are no unworked items in the queue; it could be that there are deferred items the queue is yet to release.
Exercise 9.4.2 Manually Overriding the Defer Date
It is possible to change an item’s deferral date from Control Room.
 Go to Queue Management in Control Room and select one of your deferred items.
 Right-click, select Change Deferral Date, and change the date to a few seconds into the future (you can’t change it to the past).
Exercise 9.4.3 Deferring a Working Item
Defer can also be used to release an item got from the queue without applying a “complete” or “exception” result. This feature is useful for part-working an item and then “freezing” it for later - perhaps in a Process that spans two days where items are “half” worked today and then deferred until tomorrow.
 Return to Queue Exercises 1 and change the properties of the “Mark Complete” Action stage to “Defer”. Use a similar expression as before for the Until input parameter.
 Step though the Process and go back to Queue Management to see how after “getting” an item it can be released again.
 Once you are satisfied with how Defer works, undo your changes to return the Action stage to “Mark Complete” again.
 Tip: Using Now() as the expression will make the item instantly available.

 Return to Queue Exercises 1 and confirm that items are available to be worked.
9.5. Attempts
Items can be worked more than once if necessary. The Max Attempts field on the Work Queue Configuration section of System Manager is set to 1 by default but this can be set to a higher value if necessary.
When Max Attempts is greater than 1 the work queue will revive any exception cases by cloning a new item and inserting it into the queue. The following series of tables will help to demonstrate the effect.
Exercise 9.5.1 Understanding Queue Attempts
A queue has been set up with Max Attempts=2 and there are four items in the queue. The first item has been completed but ABC-002 has just been marked as an exception.

The work queue sees that ABC-002 has attempts remaining and inserts a new cloned item into the queue before ABC-003. This cloned item will be the next available item, not ABC-003.

ABC-002 is worked again and marked as an exception again. The queue sees that no more attempts at ABC-002 are allowed (Max Attempts=2) and does not create a new item. The Process moves on to the next item, ABC-003.

Overriding Max Attempts
The Retry input parameter of the Mark Exception action in the Internal - Work Queues Business Object can then be used to override Max Attempts.
When Retry is True, the queue will generate another attempt if the limit of Max Attempts has not been reached. But when Retry is False, it will override Max Attempts and prevent any further attempts regardless of the number of retries available.
The ID of the new item is supplied as an output from Mark Exception.
Keeping hold of the new item
The Keep Locked input parameter works in conjunction with the Retry input. When Keep Locked is True, the new cloned item will become instantly locked. This provides the opportunity to carry on working on the new item. When Keep Locked False, any new item created is freely available as the “next” item.

Figure 141: Retrying an Exception Item
Exercise 9.5.2 Retrying Items
 Modify Max Attempts in the Queue2 definition and experiment with retrying a queue item.
Key Point
 A queue can be set up to enable multiple attempts on an item.
 Attempts only apply to exceptions – items marked as complete cannot be reworked.
 The creation of a retry item can be cancelled from the diagram.
9.6. Pause and Resume
A work queue can be temporarily paused so that it will not release items at all. The Resume function reactivates a paused queue.
From the perspective of a Process, a paused queue will appear devoid of available items. This feature can be a useful way of making a Process “think” it has no work to do.
Exercise 9.6.1 Pausing a Queue
 Go to the list of queues in Queue Management and right-click on a queue. Experiment with Pause and Resume to see the effect.

Figure 142: Pausing a Queue
9.7. Filters
The Queue Contents list can be filtered to display a subset of the queue. Drop-down lists above each column are used to apply a filter, and a filtered view can be saved and reapplied as required.
9.8. Reports
The Queue Contents list can be exported as a basic report.
Exercise 9.8.1 Reporting on a Queue
 Right-click on a queue item in the lower half of Queue Management.
 Select Export current view as a report and follow the subsequent steps to create a report file.
 Experiment by first adjusting the drop-down filters before exporting to create different reports.
 These extracts are intentionally “raw”; there are other ways to create reports that you will learn about as part of a mentoring program after this course.
9.9. Review
 A queue is used by a Process to manage a workload.
 Work is stored as a list of individual items.
 A special “internal” Business Object is provided to work with queue items.
 Each item contains a Collection of data to be used by the Process.
 When an item is being worked, it is locked to ensure it cannot be worked elsewhere.
 After being worked, an item is either marked as complete () or as an exception ().
 A queue can be configured so that exception items can be worked again.
 A queue can be temporarily deactivated and reactivated.
 A report of queue items can be created.
Blue Prism Keywords
Work Queue, Queue Item, System Manager, Key, Pause, Resume, Defer, Retry, Attempts.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值