Pergunta

I have multiple list in SharePoint that all feed into one large list. Sometimes a date will be added to these feeder lists but I can't get that date to update on the large list. Its seems this process relies on finding an ID number to find the right item on the list to update, but the only option I get on the update item step is for the SharePoint provided ID number on the feeder list. This does not work for me because that ID number is not the same on feeder list and large list. I have another column that provides a unique ID number that is consistent on all lists but it's not selectable under Dynamic Content. Do I have to use an expression for this? Where do I find the syntax for that.

enter image description here

EDIT based on new attempt: I'm having trouble expressing what I need. Let me try to outline what I am currently trying to do from the top based on the answer below.

[![enter image description here][2]][2]

What I am trying to do: 1) An item is entered into the feeder list. This triggers a flow to also create the same item in the large list where all feeder list items go. 2) After the item is created in the large list, I then want to get the ID number from that list and update the "Parent ID" column in the feeder list with that number. 3) If an item in the feeder list is updated, I want to then use that ID number in Parent ID in the feeder list to find the item that needs to also be updated in the large list.

Problem: I am now stuck on step 2 because I don't understand something with ID's. After the item is created on the large list, I do a get item action to get that information from that new item on the large list. I then do an update item action. I specify that I want to update the feeder list and try to find the item to update with the feeder list ID. However, the ID it seems to pull to find the item to update on the feeder list is actually an ID from the large list, so it can't find the right item to update on the feeder list. If I just type in a number as the ID, the flow works, but the Parent ID from the large list does not update on the feeder list.

So, first question, How to I get the correct ID # from the feeder list so it finds the item it needs to update on the feeder list?

Foi útil?

Solução

In the past when I have had to keep two items in two different lists "related" for possible future updates, I add a column on the origin list to store the SharePoint ID of the item in the secondary/copy list. When the process happens where the new item is created on the secondary/copy list, you should get something back that can help you identify the item in the secondary/copy list. In SarePoint 2013 workflows, this happens to be a GUID, not the normal integer SharePoint "list item ID". But that's fine, I use the GUID to find the new copied item, then get it's integer ID, then store that on the original item in the original list.

Then, if that original item gets updated and I need to update the copy item, I have the ID handy and can easily find it.


UPDATE

I am not very familiar with Flow/Power Automate, but I set up a simple test Flow to see if I could figure this out. As it turns out, in the dynamic content selection box, you can choose content from the output of any of the involved triggers or steps.

screenshot of flow with dynamic content selection box

In the image above, you can see that I have a trigger "When a new item is created" which will run on my Test List 1, which you could consider one of your "feeder" lists. Then I have a step to "Create item", and this will create a new item in Test List 2, which would be your aggregation list.

Then, I have a step to "Update item", and I'm trying to update the original item in Test List 1 (the feeder list) and set the ParentID column to hold the ID of the copied item in Test List 2 (the aggregate list). As you can see, I put the cursor in the "Id" box where you are specifying the ID of the item you are trying to update in the original list, which is the ID of the item that was created first and triggered the Flow. And, as you can see in the Dynamic content box, I can choose the ID of the item that triggered the workflow (marked by yellow highlighting) that is in a section named the same as the title of the trigger, or I could choose the ID of the item created in the "Create item" step (marked by red circles and arrows), but of course that's not the ID I want to use there, that's the one I want to set in the ParentID field on the original item.

So if I set it up that way, using the ID under "When a new item is created" to locate the item to update in the update step, and use the ID under "Create item" to set the value of the ParentID column, it works as desired.

On another note: I took a closer look at the screenshot of your Flow, and it looks like you are getting all the items from your aggregation list and looping over all of them? And your trigger is both item created and item updated. Looping over all the items in the list is not recommended, because once that list gets large it's going to take a long time to run the Flow. And having the trigger be on both item created and item updated is going to be problematic because if it's item created, you don't yet have an item in the aggregation list to update, you need to create a new item at that time.

So to avoid a lot of error handling and conditional logic, I would set it up like this:

  1. One flow that's triggered only on item created. At that point you know there isn't a related item in the aggregate list and you will need to create a new one, and then you can save the ID of that new item back to the original item in the feeder list.

  2. Have a second flow that's triggered only on item updated. At that point, you can be reasonably sure that the other flow ran when the item was first created, and it should now have a copy/related item already in the aggregate list, and that the ParentID column of the item in the feeder list should be set with the correct ID to find it. Then, you don't have to bother with getting all the items and looping over them, you can just directly update the correct item in the aggregate list.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top