I've already spoke about how powerful a workqueue in Power Automate is here, and this was before Microsoft released the functionality in the Power Platform. I was using custom tables/lists, but now Microsoft has prebuilt those tables for you, with some added sparkle.
But now its in general release I thought I would share how to use a workqueue in Power Automate, it is more aimed at Desktop flows (like other RPA tools, e.g Blue Prism, as you have limited resources that need to be managed), but that doesn't mean you can't or shouldn't use them in your cloud flows.
- Setup
- How to use
- Trigger
- Flow Action
- Delete
- Example
1. Setup
A couple of things to know, Workqueues require a premium license, and each queue needs to be setup.
The workqueue will be either under Monitor (old) or in the left menu. If it isn't there you can use this url:
https://make.powerautomate.com/environments/{your environment ID}/monitor/work-queues
We then create the workqueue (it can be used for one process or if you are brave multiple), additionally you can set an auto time out for items (that way the expire and wont be used any more, though I have never found a reason for this yet).
You now have your own workqueue, and best of all its own dashboard. This is one of the best benefits to Power Automate workqueues, from one screen you can see how your automation is performing. You can also share the workqueue so others can view the dashboard.
The Advanced Details shows the guid (workqueue id) and key for the workqueue, these will be needed to process the workqueue.
On top of viewing you can also edit the workqueue, so you can add items, delete them, and edit them. It can become a kind of control room for human in the loop actions if you need. e.g. items could be stacked up, when enough are ready a operator could log in, view all the ready items, categorise them and then release them to be processed by the next flow. This is one of the most powerful things the Power Automate Workqueue function adds, as you could replicate it all yourself with your own Dataverse table or SharePoint list, but you wont get the control room (without maybe a custom app).
2. How to use
The workqueue has a few predefined fields you can use:
- Name - I use as plane text key, it doesn't have to be unique but should help dashboard users track e.g email subject
- Priority - Low/Medium/Heigh, self explanatory but useful when you filter your queue
- Unique Id or reference - this does need to be unique and I use to link to other systems e.g. Email message id
- Expiration date - date & time when you want to auto stop processing the item
- Input - this is any data you may want to use throughout the process, I recommend creating a JSON that you then parse
- Processing notes - these are your tags, tags are used to identify where in the process the item is and helps trigger the next step
Example of input for email
{
"from":{emailAddress},
"attachment link":{sharepoint url},
"body":{emailBody}
}
Example of Processing note tags for email
- Excel
- Word
- RequestApproval
3. Trigger
To trigger our flows from the workqueue we are going to use the When a row is added, modified or deleted
action.
Our first flow should be change type created, all future flows Modified. To ensure that our flows run at the right time we need to set trigger conditions. The conditions should in general include 3 conditions:
- Workqueue ID (so we only run on right queue as the tables are shared, this is from our Advanced Details)
- Status code (e.g so wont run if on Hold)
- Processing notes (uses the tag so runs right flow)
e.g.
@and(
equals(triggerOutputs()?['body/processingresult'],'excel')
,
equals(triggerOutputs()?['body/statuscode'],1)
,
equals(triggerOutputs()?['body/_workqueueid_value'],parameters('workqueueID (workqueue)'))
)
- Flow Action
Once triggered we need to complete the action and update the item so that it can trigger the next flow/call Human in the Loop. Inline with trigger, we are using our standard Dataverse actions, this time Update a row
.
We use triggerOutputs()?['body/workqueueitemid']
as our Row ID, and the update our Processing Result with the next tag, and if needed the Status & Status Reason.
To get our input data we use a simple Parse JSON
You can update the data if need, just update the input field, though for best practice I try not too.
5. Delete
If we are processing a lot of items we can end up with a lot of data (and Dataverse is not cheap), so our workqueue should not be used as a data repository. If you need to record the information save it in a SharePoint list, SQL database, or another Dataverse table if you have lots of money 😎.
There are 2 ways to keep you queue tidy, delete each item when done, or clear the whole queue at the end of the process.
Deleting one item at a time we just use the standard Dataverse Delete a row
action.
To do the whole queue could be more complicated, luckily Microsoft has your back with the Dataverse Perform a bound action
action.
Just select the 'Work Queues item' table, ClearWorkQueue action, and use the workqueue id from the advanced details.
6. Example
So when can/should we use a workqueue, I definitely recommend for large complex processes with lots of child flows. I also think anything with lots of Human in the Loop steps is a great use case. The other is related conditions.
A simple example would be:
We have a flow that can only run when 2 reports are received. They can come at anytime and in any order (so no cheating and running on the second report).
We have 2 flows, one that is triggered by emails. If the attachment is not valid it creates an item in the workqueue and sets Hold so a Human in the Loop can check. If they find it is the right report, with something like the wrong file name, they can update the item so that it continues in the process.
Next it checks to see if there are any queued items, if yes they update it, else it creates a new item.
The reports are added as tags, the second flow only runs when the Process Notes contains both of the reports.
This is a very basic example, and there are other ways to do it, but having the functionality built in, and easy to scale (more reports, more steps) is really useful.
Overall workqueues may be best for Desktop flows (there because you have limited resources, you can use additional actions like 'get next item' and load balance those resources), but they are still very useful for cloud flows.
Further Reading
Top comments (2)
What are some of the benefits of using the power Automate workqueue vs building your own in SharePoint? Beyond the obvious row limitations which can be overcome with proper indexing.
Just wondering why pay for premium here if not needed
It's a good question, the real benefits I see are:
The control room - it can be shared really easily
But there are some negatives
Process rules (can't move from hold to in progress etc)
Limited fields
Buggy (doesn't always update in control room
Premium as you said
I still have SharePoint workqueue and in no rush to move, but I do think built in ones are the future