cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
daveatsotonuni
Frequent Visitor

How to populate a lookup field with flow

Hi, I hope you experts can help me.

 

Is it possible to populate a lookup field in Sharepoint dynamically from data taken from an Email?

 

I have a flow working nicely initializing variables to take name, email address etc from a course application received in the body of an email. However I'm unable to populate one field (Staff ID) as in the Sharepoint list (Training Details) that field is a lookup from another list (Staff  Details).

 

My only options to populate this field seems to be to select a Staff ID from the list (lookup) or to enter an expression....  I can't choose the variable I initialized for Staff ID for the text string in the application.

 

Any ideas how I can dynamically use the Staff ID in the application email and use that value to pick from the list of Staff IDs in the lookup field?

 

Many thanks Dave

1 ACCEPTED SOLUTION

Accepted Solutions

@daveatsotonuni 

 

Close 🤣

 

Have a look at the history of the create training record to see what data is being passed.  Also, try creating a record with one of those ID's directly in the create training record step.  Maybe the formatting is just not 100% and only by looking at the history will you be able to spot the difference.  Feel free to share some screenshots of the history if you are not sure (input/out).

View solution in original post

9 REPLIES 9
DamoBird365
Community Champion
Community Champion

Hi @daveatsotonuni 

 

If I have understood, as part of your solution, could you not lookup the other list (Get Items with a Filter Query) for the staff name and therefore retrieve the ID of the lookup before saving the original item back to the list?

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

Thanks for responding Damien.

 

I probably didn't explain it very well. If I was manually entering an item in the Training Details list I would need to select an existing Staff ID (looked up from the Staff List).... that would then link the training record to the staff record. In flow I want to take the Staff ID in the application email and force this into Staff ID field. Your suggestion may well help me but I wouldn't know how to implement it 😟

 

Dave 

 

DamoBird365
Community Champion
Community Champion

Hi @daveatsotonuni 

 

Maybe it's worth sharing a screenshot? 

 

If you are just attempting to write an ID back to a lookup item, it works fine for me, so I am not sure if you are experiencing an error maybe that you can share?

 

If you only know the name and you want to find the ID, you need to use get items from the other list with a filter.  Once you've obtained the ID, you can feed that back to create the item.

 

DamoBird365_0-1614287107019.png

 

Many thanks I'll try this tomorrow morning. So if I understand you correctly I get items from my Staff List (unfiltered that would be thousands) but filter it to find the relevant Staff ID. I have a unique field I can use in my filter. Can I use the variable I initialized earlier in the flow in this filter statement? i.e. StaffID='StaffID'(variable created earlier).

 

Thanks Dave 

Exactly that - use your variable from earlier in your filter.  Good luck and let me know how you get on.

Hi again, thanks for your suggestion... it sort of works but not quite!
 
I created the Get Items successfully and it's pulling back the data based on my filter:
get items.PNG 
 
Title is the name of the Staff ID field that can be seen in the URL of the Settings, Edit Column page for this field (Field=Title)
 
I can populate fields in my create item, that are not lookup fields, using the output created from the filtered Get Items above:
create training record.PNG 
 
So, the field Title above is getting populated with the correct value from 'Staff ID' Get Items.
However I want to populate the field 'Staff ID Id' and when I put my 'Staff ID' from Get Items in here from the Get, the field remains blank when the item is created.
 
When you look at this field in edit mode, it is expecting a value to be selected from a list of values (the lookup):
create training record2.PNG 
 
The value created by my Get Items is in that list, so it's valid, but it doesn't seem to want to populate the field with that value using my Get Items value.
 
Do you have any ideas what the issue could be?
 
Many thanks, Dave

@daveatsotonuni 

 

Close 🤣

 

Have a look at the history of the create training record to see what data is being passed.  Also, try creating a record with one of those ID's directly in the create training record step.  Maybe the formatting is just not 100% and only by looking at the history will you be able to spot the difference.  Feel free to share some screenshots of the history if you are not sure (input/out).

View solution in original post

Many thanks again Damien I'll give that a try sounds like a great approach!

 

Dave

Hi again Damien,

 

Thanks to your help I managed to get it working! 

 

Where I was going wrong was I was trying to put the value of Staff ID into the field, rather than it's Id. Once I realised that and figured out how to dynamically find the Id it worked perfectly 😀

 

Many thanks for setting me on the right path.

 

Regards, Dave

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (45,486)