Tuesday, December 7, 2021

Redirect ‘Link to item’ URL from-out Microsoft Flow to EditForm instead of DisplayForm

Must read

Rik de Koninghttps://www.about365.nl
My name is Rik de Koning and I work as a Functional Consultant for Portiva, which is one of the larger Office 365 implementation partners in The Netherlands. I started my career in 2011 as a SharePoint support engineer and in 2013, I went to become a SharePoint consultant where I did various projects on SharePoint Server 2010 and SharePoint Server 2013. In the last couple of years I started focusing more and more on Office 365, especially on SharePoint Online, PowerApps and Microsoft Flow. I like being challenged and for PowerApps and Flow being quite new, there are always some challenges when implementing these services. When I’m not working, I like spend some time with my family (girlfriend and son), hang out with friends, do some sports (like fitness, running, kitesurfing and snowboarding) playing videogames and just relax a little. If you have any questions, please do not hesitate to contact me!

Within Flow, you can use the ‘Link to item’ Dynamic Content attribute to add a link your item (eg. in an email). This link always points to the DisplayForm of your item. In some cases, it might come in handy to point to the EditForm instead. In this blog, I will explain you how to do this.

Link to item

To show you what the default Link to item attribute does, I added a simple list in SharePoint and created a new Flow that runs for a selected item. No further actions are required for now. When I run this Flow on an item in that list, I can see the itemURL property (which is the same as the Link to item Dynamic Content attribute) inside the OUTPUTS of the For a selected item trigger:

"ID": "1",
"itemURL": "https://TENANT.sharepoint.com/sites/SITE/_layouts/15/listform.aspx?PageType=4&ListId=%7BC9C147DD-A00B-4ACE-BA8E-E1D5AD23B2D6%7D&Source=https%3A%2F%2FTENANT.sharepoint.com%2Fsites%2FSITE%2FLists%2FJustAList%2FAllItems.aspx%3Fviewid%3D83f13711%252Dfbc8%252D46b3%252Dad13%252D4066dd95d203&RootFolder=%2Fsites%2FSITE%2FLists%2FJustAList&ID=1&ContentTypeId=0x01000C3F7C025F764048951BEF93DFEAEA2A",
"fileName": "Just an item",
"fileId": "1"

When I write this URL back into my SharePoint item and open the link, I will get redirected to the DisplayForm of that item:

Redirect to the EditForm

As you can see in the itemURL above, there is no clear URL parameter that tells me it will point me to the DisplayForm. I was triggered by the ‘PageType=4‘ parameter and started playing around with it. Quickly, I discovered that the parameter for redirecting to the EditForm instead of the DisplayForm was ‘PageType=6‘.

You can easily perform this action in Flow by using the replace() expression:


What happens with this expression is that we use a string: body(‘get_item’)?[‘{Link}’] (which is the Link to item Dynamic Content attribute) to replace a specific value: ‘PageType=4’ (which is the DisplayForm parameter) with another value: ‘PageType=6’ (which is the DisplayForm parameter).

After putting this in our Update item action, we can see that this new URL will redirect us to the EditForm:

This also works when you modified your forms using PowerApps!


source: https://www.about365.nl/2019/01/15/redirect-link-to-item-url-from-out-microsoft-flow-to-editform-instead-of-displayform/

More articles

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest articles