Flow update SharePoint list B based on Lookup column value in list A on Item Created

Iron Contributor

I have two lists A and B. List A has a lookup column to associate a record with a record from list B. When a record is created in list A I need to updated a Status column in list B. 

 

I've started the Flow with: 

  1. A trigger - New Item Created
  2. Get Item - from the same list as in point 1 using the ID from the first step as the 'Unique identifier of item to be retreived'
  3. Update Item - List Name is list B

On step 3 the value for Id ('Unique identifier of item to be updated') should come from the Lookup column in list A but all I see in the dynamic content is ID from Get Item. 

 

What am I missing? How do I retrieve the value from the Lookup column? 

7 Replies

I'm having the same problem. I've tried using Compose, but I get stuck with an array, rather than just the value and I can't get any further. I feel like I'm nearly there, but can't make the final leap. 

 

Posts/Pages I've tried to use as reference:

It also feels like we can't be the only people trying this. Anyone?

@Jacques van der Hoven, I just figured it out using the hammer/machete approach. Someone please tell me there's an easier way. The basic issue is object v. value. The Dynamic Contents blocks are objects, but that Id field wants a value.

 

Setup: I have two training sessions lists: SessionList and SignupList. Anytime someone signs up for a session, I want to increment the 'Signups' field in the SessionList for the relevant session by 1, up to the max for that session.

 

Steps:

  1. Add a 'Condition' action after the "When a new item is created...' action (you'll delete it later)
  2. Select the ID field from the "When a new item..." as one of the condition parameters (it will appear in the dynamic content, assuming it's visible in your default view of that list -- why it won't appear directly in 'Get Item', I have no idea)
  3. Click the 'Edit in Advanced Mode' link at the bottom of the Condition action to see the code value for the item in question. In my example, the lookup field was Sessions: ID and the code was
    @equals(triggerBody()?['Sessions_x003a_ID'], '')
    So "Sessions_x003a_ID" = "Sessions: ID"
  4. Copy the code for the field only. In my example:
    triggerBody()?['Sessions_x003a_ID']
  5. Add the 'Get Item' action, select the relevant Site Address and List Name and past the copied code in the ID field AND add an '@' at the front AND wrap in doublequotes AND append the 'Value' parameter from the object in the format of "?['Value']", as here:
    "@triggerBody()?['Sessions_x003a_ID']?['Value']"
  6. Delete the Condition from Step 1, save the flow, and your good to go.
    NOTE: When you return to the Flow, the value in #5 will be converted to a Dynamic Element, but it still works. Again, why this doesn't seem to be available directly, is beyond me.

I've attached a screenshot of the final result in case that's helpful. The smaller image shows what a Condition's 'advanced mode' looks like (though it's for another field I was working with, so the values are different than the instructions above).

 

Hope this helps someone else.

 

As I said, there has to be a better way, but I've spent hours banging my head against this and found none. Would love better (actual?) documentation on this tool.

Thanks - this got me started, in the end what worked - and for me was very easy was this, I found my lookup value came as a pair with its id, in this case "Channel ID", the value isn't in the list I trigger off, so SharePoint must store it hidden - revealed by Flows.

In my case I post on to a team channel webhook,  but could just as easily update the "Channel" list.

 

idlookup.png

Interesting. When you say 'came as a pair', how do you mean that? I'm probably missing something obvious, but do you have a screenshot showing this pairing?

Both the altered list id, and the id of the list where I lookup for a value (Channel list) are shown:

So the pair in this case is the Channel list's "Title" and associated "Channel ID"

 

SharePoint list ID lookup.png

Excellent. I'll check it out on my end. Thanks!

@Jacques van der Hoven 

So in my testing, I have 3 lists with various lookup columns and noticed that my lookup columns only appeared in one of the steps/lists within my flow.  When I reviewed the lookup columns, I noticed that I selected the "Linked to Item" vs the default column name.  For some reason choosing the "Linked to Item" option will not filter through in Power Automate.  If you select Company Name vs Company Name (linked to item) it will show up for you in Power Automate.

E2Data_0-1714069422495.png