One of the differences between SharePoint Designer workflows and Microsoft Flow is the way you can have multiple copies of the same flow for multiple lists and or libraries. Where in SharePoint Designer you would be able to refer to the current list. Flow does not offer this option. Therefore when you create copies of a flow you will find that you are updating the site url and the list name in many different places.
In the past I tried to make sure that my SharePoint actions would use dynamic content or variables however this was never supported as Flow wasn’t able to validate list columns during design time.
Today I tried this again and I found that things worked.
In my flow I started with a When an item is created or modified.
Then I set two variables a SiteUrl and a ListName. I used the Compose actions rather than the variables connector to do this for performance reasons. However you could consider using variables as that will make your flows more readable. We will see this shortly.
Then within my Get items action I use
outputs('ListName') outputs('SiteUrl')
and this is where you can see a small problem:
If you get it wrong you will rely on the hover over tool tips to find out what you did wrong. When you use a variable instead of a Compose action you will notice the difference.
Now when you create multiple copies of the same flow you can simply update the variables and potentially the trigger and you can copy flows from one list to another within seconds. It woud still be nice if you could get the list name and the site url out of the trigger but at least this is a good start towards creating generic flows.
In this example you are creating variables to be used in subsequent actions. Is it still the case that the trigger is going to be fixed? Meaning it’s value must be changed during each copy? Have you found a way to make the trigger entries dynamic?
Hi Adam, the only option I could possibly see work is by using the options in the flow management connector and replace on URL with another on the way. Manual copying and a single update was easier to implement so far.
Hi, how did you get the listname and url from the trigger? It is not listed in the output? Did you ‘parse’ the item link or use another expression? Thank you.
If you use any of the file or item triggers then you can create this from the list item url.
Hi, I’m just beginning to work with sharepoint. How can I get the site url and listname from the sharepoint trigger action? It is not in one of the provided outputs? Thank you.
You can create it from the item url. just split the url by /lists/ if you trigger by listitem
Thanks, I was hoping there was a “cleaner” way!
What was your input field in the Compose action for the URL? Thanks!
HI Marissa,
The follwoig expression will do the job:
concat(split(triggerBody()?[‘{Link}’],’sharepoint.com’)[0], ‘sharepoint.com’)
until you published what were input parameters in both Compose actions, this post is useless
Hi Jonm
The two compose actions get the properties from the trigger.
The SiteUrl is taken from the SiteUrl property.
The ListName comes from the ListName property.
You can select these from the Dynamic contents given by the trigger.
Hi Pieter, any chance this has changed recently and the “/Lists/” path is lo longer part of the trigger link? the link I’m getting contains “/_layouts/15/listform.aspx?…” which then redirect to the DispForm containing the “Lists” path.
Is it safe to split based on “/_layouts/” in order to get the site URL?
Arevyou maybe looking at a library rather than a list?
This is most definitely a (custom) list, here’s the output I’m getting for the trigger link:
“{Link}”: “https://****.sharepoint.com/sites/*****/_layouts/15/listform.aspx?PageType=4&ListId=3d8fd8d7-44a5-46d0-bfd7-5713e168e42b&ID=87&ContentTypeID=0x0100FFDEEE6FAB678341BC6374F4D159BD94”,
“{Name}”: “10702355”,
“{FilenameWithExtension}”: “10702355”,
“{Path}”: “Lists/OTP Approvals/”,
“{FullPath}”: “Lists/OTP Approvals/87_.000”,
“{HasAttachments}”: false,
“{VersionNumber}”: “1.0”
}
When I set up variables for sites and SharePoint lists, the following actions like Update Item or Create Item will not have all fields showing up correctly. Does this happen to your list?
I’ve not seen that. Can you send screenshots of that?