web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How can I add a Hyperl...
Power Automate
Answered

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

(0) ShareShare
ReportReport
Posted on by 48

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.

 

 
Categories:
I have the same question (0)
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    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-item.html

     

    Best Regards,

  • Head in the Cloud Profile Picture
    48 on at

    @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]

  • Head in the Cloud Profile Picture
    48 on at

    @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

  • Verified answer
    Head in the Cloud Profile Picture
    48 on at

    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-version=5.1. 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

  • AnthonyPSlalom Profile Picture
    77 on at

    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.

  • Head in the Cloud Profile Picture
    48 on at

    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.

     

  • thomas05 Profile Picture
    Microsoft Employee on at

    Hi @AnthonyPSlalom ,

    you can refer the code below to add the comment.

    thomas05_0-1627357062782.png

     

  • cassyfreeman Profile Picture
    4 on at

    Hi I realise this is an old post but I was hoping you could help. I have tried to follow your solution but am getting this issue: No api-version was supplied for the "PATCH" request

  • cassyfreeman Profile Picture
    4 on at

    Sorted it thanks 🙂

  • dfoxg Profile Picture
    on at

    I´m sending this JSON

    {
    "path": "/relations/-",
    "op": "add",
    "value": {
    "url": "https://www.google.de",
    "attributes": {
    "comment": "test"
    },
    "rel": "Hyperlink"
    }
    }

    but receiving following error message

    Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Value {\r\n \"url\": \"https://www.google.de\",\r\n \"attributes\": \"System.Collections.Hashtable\",\r\n \"rel\":
    \"Hyperlink\"\r\n} does not match the expected type
    Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemRelation.","typeName":"Microsoft.VisualStudio.Services.Common.VssPropertyValidationException,
    Microsoft.VisualStudio.Services.Common","typeKey":"VssPropertyValidationException","errorCode":0,"eventId":3000}
    In **truncated**
    + ... dWorkItem = Invoke-RestMethod -Uri $url -Method patch -UseDefaultCred ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

     Do you have an idea?

     

    I´m using the onPremises Version Dev18.M170.8

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard