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.
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.
SHAREPOINT REST WALL PAPER | https://www.microsoft.com/en-us/download/details.aspx?id=41147 |
Pingback: Part Two – Using Power Automate show the most recent comment from SharePoint text fields instead of “View Items” | Pankaj Surti's Blog