Lookup to SharePoint list with approvers in Power Automate
Posted On November 22, 2020
“I am building an approval flow in Power Automate, and need some conditions at the front to know who should get a task. I need to lookup approvers in another SharePoint list.”
When building approval flows in Power Automate, there’re many good reasons to keep the approvers in a configuration list. It can be different approvers for each user, or country, or request value. But it means you must get the approvers from a different list. You need to implement a lookup. In Power Automate it’s done using the ‘Get items’ action with ‘Filter Query’.
Add the ‘Get items’ action into your flow. You want to get data from the configuration list with the approvers, but if you don’t add any ‘Filter Query’, it’ll return all items from the list. That’s not what you want, you need only one result = one item with the approver based on the lookup. You can even limit the ‘Top Count’ to 1 if you’d like, but it’s not necessary.
Note: Make sure that there’s only 1 item in the configuration list for your filter. The column you’re using must be unique. It can be user, it can be country name, it can be request type, but it must be only once in the list.
The filters might differ based on your needs. You can lookup a person, text value, or a number. It’s even possible to use multiple filters, e.g. person AND number.
Using the lookup result
When you use a value from the ‘Get items’ later in the flow, Power Automate will automatically add ‘Apply to each’ action around it. That’s completely fine. Since the action will return only 1 item, it’ll run only once. It doesn’t look elegant, but it works as needed.
Lookup is a functionality to ‘get only related item from another list’. As already stated in the note above, you should think about the relation between the lists. You must have some unique property that will be available in both of the lists. It doesn’t have to have the same column name, but it must contain the same value.