cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HeadInTheCloud
Advocate I
Advocate I

How can I add a Hyperlink to a DevOps work item using a flow?

My flow needs to update a DevOps work item with a hyperlink. This can be done manually through the DevOps user interface by adding an existing item and selecting Hyperlink as the link type. However, in the Flow, the Update  Work Item template does not allow Hyperlink as a Link Type. I put Hyperlink into the field, but the update errored with 'Unknown relation type System.LinkTypes.Hyperlink'. I really need this. Please guide me to how I can add the Hyperlink.

 

 
1 ACCEPTED SOLUTION

Accepted Solutions

I figured out how to do it - it took me all day - but I am tickled to find a solution using the "Send an HTTP Request to Azure DevOps" action.

 

See the following Flow action where the variable IDOfWorkItem is the work item to be updated and the variable DEVOPSAPIURI is URL:  https://dev.azure.com/<organization>/<project>/_apis/wit/workitems/@{variables('IDOfWorkItem')}?api-.... The AddLinkJSON below uses a RelatedItemURL that is in the form "https://....". Setting the Content-Type was one key to getting this to work.

 

Adding a hyperlink to a work item using Flow HTTP PATCH.JPG

Here's proof:

Successful flow to add a link.JPG

 

and the link now appears on the work item

Added link on work item.JPG

View solution in original post

7 REPLIES 7
v-bacao-msft
Community Support
Community Support

 

Hi @HeadInTheCloud ,

 

It seems we can't add hyperlink to work item, please check this similar thread:

https://developercommunity.visualstudio.com/content/problem/308914/not-able-to-add-hyperlink-to-work...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-bacao-msft Thanks for the reply to my post. I'm not sure that applies to my issue since I am able to add a Hyperlink to a Work Item via the Web UI by going to the Links Tab and selecting the Add Link - Existing Item drop down option. That opens the form shown below and I can enter the URL and select Hyperlink in the Link Type. 

Adding a hyperlink to a work item in Azure DevOps (Existing)

 

[edit - the UI image is in the next reply]

@v-bacao-msft Thanks for the reply to my post. I'm not sure that applies to my issue since I am able to add a Hyperlink to a Work Item via the Web UI by going to the Links Tab and selecting the Add Link - Existing Item drop down option. That opens the form shown in the first screen shot below and I can enter the URL and select Hyperlink in the Link Type. My problem is that I need to add a link to a Dynamics CRM record to a Work Item in a Flow. Options in the DevOps "Update A Work  Item" action allows me to add a link to another Work Item (see second screen shot), but not to a CRM item. IMO, that's an operation Flow should offer. "Create A Work Item" appears to have the same limitation.

 

Adding a hyperlink to a work item in Azure DevOps (Existing).JPG

 

Here's what Flow offers me for Link Type options - only links to other work items -

 

Link types available when updating a work item via Flow.JPG

I figured out how to do it - it took me all day - but I am tickled to find a solution using the "Send an HTTP Request to Azure DevOps" action.

 

See the following Flow action where the variable IDOfWorkItem is the work item to be updated and the variable DEVOPSAPIURI is URL:  https://dev.azure.com/<organization>/<project>/_apis/wit/workitems/@{variables('IDOfWorkItem')}?api-.... The AddLinkJSON below uses a RelatedItemURL that is in the form "https://....". Setting the Content-Type was one key to getting this to work.

 

Adding a hyperlink to a work item using Flow HTTP PATCH.JPG

Here's proof:

Successful flow to add a link.JPG

 

and the link now appears on the work item

Added link on work item.JPG

View solution in original post

Thanks for sharing this solution.  Only thing I can't seem to figure out is to how to add a comment.  I've tried adding these to the JSON with no success

 

"comment":"sample comment"

"linkcomment":"sample comment"

"link comment":"sample comment"

 

I've also tried the above with the L & C capitalized in case things are case sensitive

 

Any guidance is much appreciated.

HeadInTheCloud
Advocate I
Advocate I

I haven't added a comment to a work item, but I have retrieved comments with an HTTP request and they are returned in an array. I hope that helps. If you have figured out how to do it, it would be great if you could post the solution.

 

Hi @AnthonyPSlalom ,

you can refer the code below to add the comment.

thomas05_0-1627357062782.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Kudoed Authors
Users online (1,697)