I am attempting to set a field to the ID of the item when an item is added to the SharePoint list. It fails with this:
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body/ID']' is of type 'Integer'. The result must be a valid array.
I understand that, but since they are marked as required they need to be filled in each time you do an update. So you'll need to use the current values to fill in each field when you do the update. That's why its usually not a good idea to make all the fields required.
I am now using the Update Item, but it is still expecting values in all the required fields. The user enters values for the required fields when they add the item.
So you are trying to update a set of items in another list with the ID of the item that was added. If you want to do that you need to do a get items on the second list with some kind of filter to get the items you want to update with the ID. You would then do an Apply to Each on that output. If you just want to copy the ID to the ListID field then you don't need a Loop. Just an update item. The reason you need to fill in all the fields is because they are all marked as required in SharePoint. You can tell that by the red asterisk next to the field name in the Update Item action.
Also, I was forced to provide values for all the required fields even though I just want to set the value of the Field "List ID' to the ID of the new list item. So, I set each required field to itself.
Why are you using a loop at this point? The ID you are trying to add is a single Integer value. There is no need to process it as a loop. Could you provide a screenshot of your flow? That would make it easier to tell you how to fix it.
WarrenBelz
146,631
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,991
Most Valuable Professional