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

%3CLINGO-SUB%20id%3D%22lingo-sub-82325%22%20slang%3D%22en-US%22%3EFlow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-82325%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20two%20lists%20A%20and%20B.%20List%20A%20has%20a%20lookup%20column%20to%20associate%20a%20record%20with%20a%20record%20from%20list%20B.%20When%20a%20record%20is%20created%20in%20list%20A%20I%20need%20to%20updated%20a%20Status%20column%20in%20list%20B.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20started%20the%20Flow%20with%3A%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EA%20trigger%20-%20New%20Item%20Created%3C%2FLI%3E%3CLI%3EGet%20Item%20-%20from%20the%20same%20list%20as%20in%20point%201%20using%20the%20ID%20from%20the%20first%20step%20as%20the%20'Unique%20identifier%20of%20item%20to%20be%20retreived'%3C%2FLI%3E%3CLI%3EUpdate%20Item%20-%20List%20Name%20is%20list%20B%3C%2FLI%3E%3C%2FOL%3E%3CP%3EOn%20step%203%20the%20value%20for%20Id%20('Unique%20identifier%20of%20item%20to%20be%20updated')%20should%20come%20from%20the%20Lookup%20column%20in%20list%20A%20but%20all%20I%20see%20in%20the%20dynamic%20content%20is%20ID%20from%20Get%20Item.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20am%20I%20missing%3F%20How%20do%20I%20retrieve%20the%20value%20from%20the%20Lookup%20column%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-82325%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-144605%22%20slang%3D%22en-US%22%3ERe%3A%20Flow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-144605%22%20slang%3D%22en-US%22%3E%3CP%3EExcellent.%26nbsp%3BI'll%20check%20it%20out%20on%20my%20end.%20Thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-144602%22%20slang%3D%22en-US%22%3ERe%3A%20Flow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-144602%22%20slang%3D%22en-US%22%3E%3CP%3EBoth%20the%20altered%20list%20id%2C%20and%20the%20id%20of%20the%20list%20where%20I%20lookup%20for%20a%20value%20(Channel%20list)%20are%20shown%3A%3C%2FP%3E%0A%3CP%3ESo%20the%20pair%20in%20this%20case%20is%20the%20Channel%20list's%20%22Title%22%20and%20associated%20%22Channel%20ID%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20883px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F26781i91D6C710CF4E3128%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22SharePoint%20list%20ID%20lookup.png%22%20title%3D%22SharePoint%20list%20ID%20lookup.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-144597%22%20slang%3D%22en-US%22%3ERe%3A%20Flow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-144597%22%20slang%3D%22en-US%22%3E%3CP%3EInteresting.%20When%20you%20say%20'came%20as%20a%20pair'%2C%20how%20do%20you%20mean%20that%3F%20I'm%20probably%20missing%20something%20obvious%2C%20but%20do%20you%20have%20a%20screenshot%20showing%20this%20pairing%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-144585%22%20slang%3D%22en-US%22%3ERe%3A%20Flow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-144585%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20-%20this%20got%20me%20started%2C%20in%20the%20end%20what%20worked%20-%20and%20for%20me%20was%20very%20easy%20was%20this%2C%20I%20found%20my%20lookup%20value%20came%20as%20a%20pair%20with%20its%20id%2C%20in%20this%20case%20%22Channel%20ID%22%2C%20the%20value%20isn't%20in%20the%20list%20I%20trigger%20off%2C%20so%20SharePoint%20must%20store%20it%20hidden%20-%20revealed%20by%20Flows.%3C%2FP%3E%0A%3CP%3EIn%20my%20case%20I%20post%20on%20to%20a%20team%20channel%20webhook%2C%26nbsp%3B%20but%20could%20just%20as%20easily%20update%20the%20%22Channel%22%20list.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20621px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F26779i73F1068271FF37E3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22idlookup.png%22%20title%3D%22idlookup.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-88302%22%20slang%3D%22en-US%22%3ERe%3A%20Flow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-88302%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1658%22%20target%3D%22_blank%22%3E%40Jacques%20van%20der%20Hoven%3C%2FA%3E%2C%20I%20just%20figured%20it%20out%20using%20the%20hammer%2Fmachete%20approach.%20Someone%20please%20tell%20me%20there's%20an%20easier%20way.%20The%20basic%20issue%20is%20object%20v.%20value.%20The%20Dynamic%20Contents%20blocks%20are%20objects%2C%20but%20that%20Id%20field%20wants%20a%20value.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESetup%3A%20I%20have%20two%20training%20sessions%20lists%3A%20SessionList%20and%20SignupList.%20Anytime%20someone%20signs%20up%20for%20a%20session%2C%20I%20want%20to%20increment%20the%20'Signups'%20field%20in%20the%20SessionList%20for%20the%20relevant%20session%20by%201%2C%20up%20to%20the%20max%20for%20that%20session.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESteps%3A%3C%2FP%3E%3COL%3E%3CLI%3EAdd%20a%20'Condition'%20action%20after%20the%26nbsp%3B%3CSPAN%3E%22When%20a%20new%20item%20is%20created...'%20action%20(you'll%20delete%20it%20later)%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3ESelect%20the%20ID%20field%20from%20the%20%22When%20a%20new%20item...%22%20as%20one%20of%20the%20condition%20parameters%20(it%20will%20appear%20in%20the%20dynamic%20content%2C%20assuming%20it's%20visible%20in%20your%20default%20view%20of%20that%20list%20--%20why%20it%20won't%20appear%20directly%20in%20'Get%20Item'%2C%20I%20have%20no%20idea%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3EClick%20the%20'Edit%20in%20Advanced%20Mode'%20link%20at%20the%20bottom%20of%20the%20Condition%20action%20to%20see%20the%20code%20value%20for%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CSPAN%3Ethe%20item%20in%20question.%20In%20my%20example%2C%20the%20lookup%20field%20was%20Sessions%3A%20ID%20and%20the%20code%20was%3C%2FSPAN%3E%3C%2FSPAN%3E%3CPRE%3E%40equals(triggerBody()%3F%5B'Sessions_x003a_ID'%5D%2C%20'')%3C%2FPRE%3E%3CSPAN%3ESo%20%22Sessions_x003a_ID%22%20%3D%20%22Sessions%3A%20ID%22%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%3E%3CSPAN%3ECopy%20the%20code%20for%20the%20field%20only.%20In%20my%20example%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CPRE%3EtriggerBody()%3F%5B'Sessions_x003a_ID'%5D%3C%2FPRE%3E%3C%2FLI%3E%3CLI%3EAdd%20the%20'Get%20Item'%20action%2C%20select%20the%20relevant%20Site%20Address%20and%20List%20Name%20and%20past%20the%20copied%20code%20in%20the%20ID%20field%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20add%20an%20'%40'%20at%20the%20front%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20wrap%20in%20doublequotes%20%3CSTRONG%3EAND%3C%2FSTRONG%3E%20append%20the%20'Value'%20parameter%26nbsp%3Bfrom%20the%20object%20in%20the%20format%20of%20%22%3F%5B'Value'%5D%22%2C%20as%20here%3A%3CBR%20%2F%3E%3CPRE%3E%22%40triggerBody()%3F%5B'Sessions_x003a_ID'%5D%3F%5B'Value'%5D%22%3C%2FPRE%3E%3C%2FLI%3E%3CLI%3EDelete%20the%20Condition%20from%20Step%201%2C%20save%20the%20flow%2C%20and%20your%20good%20to%20go.%3CBR%20%2F%3E%3CSTRONG%3ENOTE%3A%3C%2FSTRONG%3E%20When%20you%20return%20to%20the%20Flow%2C%20the%20value%20in%20%235%20will%20be%20converted%20to%20a%20Dynamic%20Element%2C%20but%20it%20still%20works.%20Again%2C%20why%20this%20doesn't%20seem%20to%20be%20available%20directly%2C%20is%20beyond%20me.%3C%2FLI%3E%3C%2FOL%3E%3CP%3EI've%20attached%20a%20screenshot%20of%20the%20final%20result%20in%20case%20that's%20helpful.%20The%20smaller%20image%20shows%20what%20a%20Condition's%20'advanced%20mode'%20looks%20like%20(though%20it's%20for%20another%20field%20I%20was%20working%20with%2C%20so%20the%20values%20are%20different%20than%20the%20instructions%20above).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps%20someone%20else.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20I%20said%2C%20there%20has%20to%20be%20a%20better%20way%2C%20but%20I've%20spent%20hours%20banging%20my%20head%20against%20this%20and%20found%20none.%20Would%20love%20better%20(actual%3F)%20documentation%20on%20this%20tool.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-88266%22%20slang%3D%22en-US%22%3ERe%3A%20Flow%20update%20SharePoint%20list%20B%20based%20on%20Lookup%20column%20value%20in%20list%20A%20on%20Item%20Created%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-88266%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20having%20the%20same%20problem.%20I've%20tried%20using%20Compose%2C%20but%20I%20get%20stuck%20with%20an%20array%2C%20rather%20than%20just%20the%20value%20and%20I%20can't%20get%20any%20further.%20I%20feel%20like%20I'm%20nearly%20there%2C%20but%20can't%20make%20the%20final%20leap.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPosts%2FPages%20I've%20tried%20to%20use%20as%20reference%3A%3C%2FP%3E%3CUL%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FGeneral-Flow-Discussion%2FHow-to-filter-the-array-to-get-single-item%2Ftd-p%2F14981%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FGeneral-Flow-Discussion%2FHow-to-filter-the-array-to-get-single-item%2Ftd-p%2F14981%3C%2FA%3E%20(example%20of%20Compose)%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FBuilding-Flows%2FGet-access-to-single-element-of-array-outside-of-loop%2Ftd-p%2F34844%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FBuilding-Flows%2FGet-access-to-single-element-of-array-outside-of-loop%2Ftd-p%2F34844%3C%2FA%3E%20(My%20situation%20isn't%20a%20loop%20--%20I%20don't%20think%20--%20but%20thought%20it%20might%20lead%20somewhere)%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FBuilding-Flows%2Fhow-to-get-sharepoint-lookup-list-value-in-flow-email%2Ftd-p%2F11800%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fpowerusers.microsoft.com%2Ft5%2FBuilding-Flows%2Fhow-to-get-sharepoint-lookup-list-value-in-flow-email%2Ftd-p%2F11800%3C%2FA%3E%20(the%20solution%20near%20the%20bottom%20looks%20like%20how%20I%20would%20expect%20it%20to%20work%2C%20but%20it's%20not%20working%20for%20me)%3C%2FLI%3E%3C%2FUL%3E%3CP%3EIt%20also%20feels%20like%20we%20can't%20be%20the%20only%20people%20trying%20this.%20Anyone%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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? 

6 Replies
Highlighted

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?

Highlighted

@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.

Highlighted

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

Highlighted

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?

Highlighted

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

Highlighted

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