How to update Hyperlink field using ‘Send an HTTP request to SharePoint’ in Power Automate?

Problem

It is not a problem. The question is how to update a hyperlink field in Power Automate using “Send an HTTP request to SharePoint” REST api?

To simplify the solution here are two fields in the SharePoint list. Let’s use a default template ‘When an item created’ trigger to update the second field “CompanyUrl” with a value of the clickable URL.

The sample list “URLTesterList” with two fields, one default field Title and other CompanyUrl.
The CompanyUrl field is a Hyperlink field.

Step by Step solution

Step # 1

Use a trigger to start your work flow in this example ‘when an item is created’ with a Title field with some value e.g. Microsoft or Google.

Here is the formula in the Compose action for constructing an URL for CompanyUrl field.

Take a title value append ‘.com‘ and prepend ‘https://www.‘ This will create a full url as ‘https://www.{WHATEVER TITLE HAS}’.com

concat(
'https://www.',
concat(
triggerOutputs()?['body/Title'],
'.com'
)
)

Step # 2

Provide the values for Site address, Method as ‘POST’ and Uri as following.

Note: the items has dynamic ID field.

_api/web/lists/GetByTitle('URLTesterList')/items('@{triggerOutputs()?['body/ID']}')

Step # 3

Provide the headers portion, you may copy paste from the following by clicking “T” symbol (green circle) on the far right of the headers. Simply copy these value to the headers section

{
"content-type": "application/json;odata=verbose",
"IF-MATCH": "*",
"X-HTTP-Method": "MERGE"
}

Step # 4

Now this is an important step. If you notice in the following JSON string there is a “__metatdata” filed with type for your list the list name will be different. Please make a change in the type as highlighted in bold with your list name.

The required JSON value for the body section

{
"__metadata": {
"type":"SP.Data.URLTesterListListItem"
},

"CompanyUrl": {
"__metadata": {
"type":"SP.FieldUrlValue"
},
"Url":"@{outputs('ComposeURLValue')}",
"Description": "@{outputs('ComposeURLValue')}"
}
}

Result

Once the flow executes your should see the field CompanyUrl updated as following.

The list updates the CompanyUrl as an item is created with Title field with company name.
SHAREPOINT REST WALL PAPERhttps://www.microsoft.com/en-us/download/details.aspx?id=41147
Use the above link to download the SharePoinbt Wall paper to explore more REST calls.

About Pankaj

I am a Developer and my linked profile is https://www.linkedin.com/in/pankajsurti/
This entry was posted in Power Automate, Uncategorized. Bookmark the permalink.

2 Responses to How to update Hyperlink field using ‘Send an HTTP request to SharePoint’ in Power Automate?

  1. Pingback: Part Two – Using Power Automate show the most recent comment from SharePoint text fields instead of “View Items” | Pankaj Surti's Blog

  2. ComeOnSteph says:

    Can you use this for a SharePoint action: When an item or file is modified?
    Scenario: I have a flow that creates a document folder and a doclink to this folder when a new item is created (no problems). There have been times when the user renames the folder and the doclink is broken. How do you update the doclink to match the folder name change?

Leave a comment