cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Waryoldguy
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.

2 REPLIES 2

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:

 

https://www.dmcinfo.com/latest-thinking/blog/id/9832/creating-sharepoint-list-items-in-microsoft-flo...

 

 

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

Thanks,

 

Dan

Waryoldguy
Level: Power Up

Re: Create new Task with Document as a Related Item

@danmitchell36 

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

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,091)