While planning out a new series I want to do around PowerApps and Flow I realized one of the things I needed to do was get the value of a lookup field into a text field. Now we all know that using a calculated field for this isn’t going to work since they can’t see lookup fields. Yes I could use a choice field instead, but in this case I wanted a lookup field so that the users could easily update the choices from the lookup list. There are a number of examples of doing this with a SharePoint Designer Workflow. So I got thinking, but about Flow? I found a number of examples of users asking for ways to do this or having problems doing it, but nothing really concrete. So I decided to write something up quick as it really is very easy to do with flow.
Using Microsoft Flow to Update a Field From a Lookup Column
The list I am working with is pretty straight forward. It has Person\Group field, Lookup field for Departments and then a Department text field.
Next I wanted to create a flow when an item is added. Just click on Flow – See Your Flows (Don’t you love the integration?).
Click on “+ Create from blank” to start a new flow without a template.
I want the flow to be triggered when an item is created in the list. Luckily this is a popular trigger otherwise I would have to go hunting.
First thing you want to do is name the flow:
Set the site and list that Flow needs to watch for new items
You are going to get a whole schwack of options:
I suggest you filter by clicking on SharePoint and typing update in the search bar:
Then click on SharePoint – Update Item
Enter in the site information an in the ID field, select the ID from the “When Item is created” action before.
Finally, you have to set the Department field, but also the Title field. I am not sure why Flow still sees Title as required even though I set it to hidden. If anyone knows, please put in comments. You want to select the value of the Lookup field. In this case it is called “DepartmentLkUp Value”
Finally click on “Create Flow” at the top and that’s it. Your process is ready to go. Just add an entry and you will see the flow update the item:
Successful run of Flow:
Thanks for reading!