I would like to include the name of an MS List in the subject of an email so that the recipient knows which list this email is about. I am using a recurrence flow to compile the daily changes that have occurred in a list and then sending out emails in Apply to Each to the various people assigned to those changes.
I thought since I manually specify the List in Get Items that I could simply initialize a variable with Name from this but when trying the variable is automatically put inside another Apply to Each. Since the flow only concerns one List I'm sure this is not the right way. How do I go about this?
Ok I tried this and it works great so thank you. I am just wondering though if it is possible to get the list name via a Calculated Column in Lists, since then it would automatically be accessible after the Get Items action. I've tried to search for the formula but haven't found anything.
Or I suppose I could add it manually and then use something below to retrieve it from a filter array (where field_3 is the name of the column with the list name in it):
body('Filter_array_2')?[0]?['field_3']
Hi @Power_Automater,
As far as I am aware there are only two actions which interact with lists and both of them retrieve all items and don't have a filter capability. That's why I used the approach with the built in Send an HTTP request to SharePoint action.
Btw, another approach would be to extract it from one of the fields in the output of your get items. This means you don't have to add an additional action.
Below is an example of that second approach.
This expression only works if the get items action returns at least one item. It gets the path property and splits on / to retrieve the list name of the value.
split(outputs('Get_items')['body/value'][0]['{path}'], '/')[1]
Thank you @Expiscornovus I will give this a try later today and let you know how I go. Is there really no built in action in Automate/Flow to get the name/title of a list? It seems strange that it is possible to get all of the list data in each row and column but not the name of the list itself.
Hi @Power_Automater,
You could reuse what you have selected in the Get Items. This is stored as one of the input parameters. However, the challenge is that it is stored with the GUID of the list and not the actually name. You can workaround this by using a Send an HTTP request action to retrieve the title.
Below is an example of that approach.
The Send an HTTP request actions uses a GET method to retrieve the properties of your selected list in the Get Items. In this example I am only returning the Title. Which will be stored in a string variable in the action after that.
_api/web/lists(guid'@{actions('Get_Items')['inputs']['parameters']['table']}')?$select=Title
WarrenBelz
146,653
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional