Showing results for 
Search instead for 
Did you mean: 
Level: Power Up

Create new Task with Document as a Related Item

I have a sharepoint designer workflow that adds a task to a list when a document is added to a library, and makes the document a Related Item on the new list item. I have un-hidden the Related Items field from the Task content type. I add the field to both the library and the list, and when the document is added as a related item to the list item, SharePoint makes it a two way link.

I would like to try and use Flow to replicate this workflow. I need the Item ID, the GUID for the Web, and the GUID for the list. The format for a related item is:

{"ItemId":<id>,"WebId":"<guid here>","ListId":"<guid here>"}

...and the list of related items is contained in square brackets: [{related item 1},...,{related item N}]


So the question is, can I get the Web and List GUIDs in Flow, or do I have to create some function to find them and call that from the flow. There will be multiple sites containing this list so I would like to make the Flow as generic as possible.


Re: Create new Task with Document as a Related Item

@Waryoldguy ,


I created a very similar Flow to this. What you will need to do is create a hyperlink field on the task and add the url of the document, or the document library in that field. 


One thing to note is that Flow does not support populating a hyperlink field with the create or update item actions so you will need to create or update the task field using a REST API. It is actually very easy to do and I wrote a blog post on what you need to do. Check it out below:



If this works for you please mark as the solution and give kudos!




Level: Power Up

Re: Create new Task with Document as a Related Item


Thanks, this looks like the correct rabbit hole to go down, though my needs are slightly different. I will need to parse out what a related item looks like in JSON. I am sure that Flow cannot write that field directly either.

Getting the webid is easy as it comes back as a single value. Any idea how to get the GUID of a library without all the other bits? Calling getbytitle() seems a bit dodgey with libraries, whereas it always seems to work with a list. It is also bringing a lot of baggage to get a single value.

Helpful resources


Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020


Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!


Australia Summit

Travel to Melbourne and network with thousands of peers!


Microsoft Learn

Learn how to build the business apps that you need


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 62 members 4,739 guests
Please welcome our newest community members: