How to update the input value of in processing work queue item in Power Automate Desktop?
Use Case
The Power Automate Desktop (v2.50) allows updating value of work queue items without changing the status of an item. However, it failed to update the input value while processing the work queue items (Processing Status).
Through this tutorial I have explained the process to solve this problem by updating the value of ‘Queued‘ invoice items with the latest values stored in an input csv file. The value of work queue items is being replaced with JSON object using “𝗨𝗽𝗱𝗮𝘁𝗲 𝘄𝗼𝗿𝗸 𝗾𝘂𝗲𝘂𝗲 𝗶𝘁𝗲𝗺” action while processing the items.
Scenario
We have an item ‘Item 1’ with ‘Queued’ state in work queue ‘Work Queue 1’. It contains an invoice id in the input value:
Solution
We will first create a canvas app that allows us to set the value of column ‘Allow update item input while in processing.‘. Setting this column is the key in updating the value of a work queue item while processing it.
1. Create a Canvas app that allows changing setting for a work queue:
Go to power apps maker portal. Select ‘Apps‘ from left navigation and click ‘Start with data‘ tile.
Scroll down a bit. Click ‘Select existing tables’ option under ‘Other way to get started’ section:
In the next screen, search for ‘Work Queue’ table in the search table text box and select ‘All’ in the result grid:
Select ‘Work Queue’ table from search grid & click ‘Create app’
It will take some time to create an app. Once app is created, select the form on the right side of the screen:
Under form properties, click ‘selected’ button link to add ‘Allow update an item input while in processing.‘ column or field on the form. This will prompt a pop up to add more field on the form. Click ‘Add field’ on the top of the pop up:
Select check box against ‘Allow update an item input while in processing.‘ field or column and press ‘Add’ button:
Click ‘Save’ button. It will ask for entering the app name. You may give the name as ‘Work Queue Manager’ or as you like. Post entering app’s name, click ‘Save’ button
Click ‘Publish’ button to publish the app. After inserting optional description, click ‘Publish this version’ button:
Go back to power apps maker portal. You can see ‘Work Queue Manager’ app under ‘My apps’ section. Select ‘Play’ option from the menu to launch & run the app:
Select the work queue for which setting needs to be changed. Click ‘Edit’ icon to update the work queue record:
Choose the value of field or column ‘Allow update item input while in processing.‘ to ‘Yes’ and click tick icon to save the record:
First part is completed where we have created an app that allows us to change the app setting or update work queue record.
2. Create Desktop flow to update input value of work queue item
Create a new Power Automate desktop flow. Add an action ‘Process work queue items’ action. Select ‘Work Queue 1’ from the drop down:
Next, add ‘Read from csv file’ action to read csv data into data table variable. Enter the csv file full path in ‘File Path’ property:
In the advanced setting, toggle on ‘First line contains column names’ flag as input csv files has column names as the first row. Click ‘Save’ button to save the action:
Post that add “Filter data table” action to filter the row from csv data based on the input value of work queue item. Select the value of CSVTable variable from the previous action in ‘Data table’ property:
To apply filter condition, click ‘Edit’ button on the right side of ‘Filter to apply’ property:
Enter the text ‘InvoiceId’ in column name parameter. Select the operator as ‘Equal to’. Select the Value property of WorkQueueItem object in the value parameter. Click ‘Done’ to save the filter query:
Click ‘Save’ to save ‘Filter data table’ action
Now, add “For each” action to iterate the filtered rows returned from “Filter data table” action. Select the ‘FilteredDataTable’ variable in ‘Value to iterate’ parameter:
In the for each loop, add “Set variable” action to create a JSON object based on the value returned by filtered rows. Give ‘NewInputValue’ as the variable name & enter below code in the ‘Value’ input parameter:
{
"InvoiceId": %CurrentItem['InvoiceId']%,
"InvoiceDate": %CurrentItem['InvoiceDate']%,
"AccountName": %CurrentItem['AccountName']%,
"ContactEmail": %CurrentItem['ContactEmail']%,
"Amount": %CurrentItem['Amount']%,
"Status": %CurrentItem['Status']%
}
Finally, add “Update work queue item” action to update the input value of work queue item. Choose the status parameter as ‘[Unchanged]’. Select ‘NeInputValue’ in the ‘Input’ property. Add some relevant notes if required:
Save the action. Run the flow to verify the output.
Output
The value of work queue item has been successfully updated by the desktop flow:
Conclusion
The option to update the input value for in processing work queue items is not present in UI but we can overcome this issue by setting up a canvas app on ‘Work Queue’ table. The custom canvas app allows us to set the flag that allows updating work queue items during processing.
Hopefully, Power Automate product team will soon allow users to set this feature directly from ‘Work Queue’ screens in future releases of PAD.