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

Use Variable for a List Name with Get Items, Create Item, Update Item ??

I have a flow based on file creation and modification that creates/updates items in lists based on metadata from the file.  There are 25 possible list destinations based on a metadata column.  I use the Switch Case to direct the flow to the corresponding list.  In each Case there is logic that I have to recreate 24 times to use the correct list in get,update,create.  I would like to be able to set a variable in the each Case and write the logic one time using the variable list name in subsequent get,update,create.  Is this possible?  

setvar.jpg
Get Items doesnt seem to mind that a string variable
getitem.jpg

But Create Item complains 
createItem.jpg

Is there a better way?

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @kreeder,

 

I am afraid that filling in the variable in the List name is not feasible for Create item and Update item.

Because these two actions need to determine the list name to get the fields that need to be created or updated.

Maybe you could try using Send an Http request to SharePoint to create Item and Update item.

I did a test on my side, using Create item as an example:

16.PNG

17.PNG

Updating an Item is similar to creating an Item. Here are some links you can refer to on how to update items using Http request.

https://veenstra.me.uk/2018/07/02/microsoft-flow-update-a-list-item-with-a-people-field-using-rest-a...

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-re...

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-bacao-msft
Community Support
Community Support

Hi @kreeder,

 

I am afraid that filling in the variable in the List name is not feasible for Create item and Update item.

Because these two actions need to determine the list name to get the fields that need to be created or updated.

Maybe you could try using Send an Http request to SharePoint to create Item and Update item.

I did a test on my side, using Create item as an example:

16.PNG

17.PNG

Updating an Item is similar to creating an Item. Here are some links you can refer to on how to update items using Http request.

https://veenstra.me.uk/2018/07/02/microsoft-flow-update-a-list-item-with-a-people-field-using-rest-a...

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-re...

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks I will give it a try.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

Users online (74,189)