cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msalamonjl
Helper I
Helper I

Parameterizing SharePoint List Information

I have a flow that syncs data from a data source to a SharePoint list.   After getting the information from the data source, the flow does the following:

  • Queries the SharePoint list to see if the corresponding record already exists
  • If so, updates the record
  • If not, inserts the record

Therefore, my flow has 3 separate SharePoint actions that all call the same list.

I plan to copy and reuse this flow to sync data to different SP lists.  (This flow cannot be turned into a public template for various reasons, including that it uses a custom connector.)

I would like to "parameterize" the SharePoint list information at the top of my flow, store the SharePoint site and list information at the beginning and then use that information to automatically populate this information in the 3 SharePoint actions.  (I realize that additional configuration will be required to set the value of each column in the SharePoint list in the Create Item and Update Item actions, but anything I can do to simplify the configuration of the flow would be helpful.)  However, this does not seem to be possible. 

(In contrast, I could create an Email variable at the top of my flow and use that variable to populate the To field of an Outlook Send Email action.)

Is there any way to achieve this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @msalamonjl ,

you can do that by using variables for the 'Site Address' and the 'List Name'. Initialize the variables at the beginning, you'll update them for each flow. Then you can use these variables in the other actions. The only complication will come with the item create/update actions. If you use variables for the 'Site Address' and 'List Name' the flow will not be able to load the specific columns for that list = you can't use the 'Create item' and 'Update item' actions directly. You'll have to use HTTP requests for the operations. You can check the older threads to see how to create the HTTP requests:

Create item: https://powerusers.microsoft.com/t5/Building-Flows/use-flow-to-update-various-sharepoint-group-sites...

Update item: https://powerusers.microsoft.com/t5/Building-Flows/Update-mutliple-fields-for-item-using-REST-api/td...  

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

3 REPLIES 3
tom_riha
Super User
Super User

Hello @msalamonjl ,

you can do that by using variables for the 'Site Address' and the 'List Name'. Initialize the variables at the beginning, you'll update them for each flow. Then you can use these variables in the other actions. The only complication will come with the item create/update actions. If you use variables for the 'Site Address' and 'List Name' the flow will not be able to load the specific columns for that list = you can't use the 'Create item' and 'Update item' actions directly. You'll have to use HTTP requests for the operations. You can check the older threads to see how to create the HTTP requests:

Create item: https://powerusers.microsoft.com/t5/Building-Flows/use-flow-to-update-various-sharepoint-group-sites...

Update item: https://powerusers.microsoft.com/t5/Building-Flows/Update-mutliple-fields-for-item-using-REST-api/td...  

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Tom, I think that approach will work. Obviously it would be nice if the create and update item actions could be more dynamic.

 

Btw, the solution requires the HTTP action and constructing the body with the correct information.  it would be much easier to construct the body using a text editor instead of needing to insert expressions for every column value.  (There are over 25 columns.)  Do you know if there is a way to construct the body to include variables and outputs in a text editor?

Hello @msalamonjl ,

what do you mean by expressions for every column value? Every dynamic content has code on the background, so you can use a dynamic content in some action and then select/copy/paste it into a text editor if that helps. Below is an example from SharePoint 'Date' column that's output of 'Apply to each 2' action. If you paste the code including the opening @{ and closing } into some PA action it'll be translated as dynamic content in the flow.image.png 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,714)