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

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:

replace(
	body('get_item')?['{Link}'],
	'PageType=4',
	'PageType=6'
)

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!

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

  1. Thank you so much! If we expect users to input information, it’s more user friendly to direct them to edit mode.

    2
    0

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

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