February 18, 2021

Update SharePoint Hyperlink fields with URL and Description using Power Automate (MS Flow)

Introduction

We recently implemented an automated approval process in SharePoint Online using Power Automate for the HR department of an Engineering Company based out of Denmark. We came across a scenario wherein it was required to update the value of the Hyperlink field in the SharePoint list with URL & Description from Power Automate.

Problem Statement

We cannot directly update the value of the Hyperlink field with description from using "Update Item" action in Power Automate (MS Flow). So in this article, we will see how to update the value of the Hyperlink field with URL & Description using HTTP Request Action in Power Automate.

Resolution

As an alternate, we can use "Send an HTTP request to SharePoint" action in Power Automate to update the value of the Hyperlink field with URL & Description in SharePoint. Let's see the step by step process to perform the same, for easier understanding we will go with an example SharePoint List with a straightforward scenario.

SharePoint List

We have already created a SharePopint List with two fields Title (Single Line of Text) and Address (Hyperlink).


Steps to Follow

Step 1: Open your flow and add "When an item is created" trigger and provide your "Site Address" and "List Name".


Step 2: Add a new action "Send an HTTP request to SharePoint".



Step 3: Once successfully added, provide all the details as required.


Site Address: Your Site Address

Method: POST

Uri :  _api/web/lists/GetByTitle(‘ListName’)/items([ID]). (Update “ListName” to your list’s name & replace “[ID]” with the ID field from dynamic content).

 

Step 4: Click on “Text Mode” in "Send an HTTP request to SharePoint" action.



Step 5:  Add the below code in the Header Textbox.
1:  {  
2:  "Content-Type": "application/json;odata=verbose",  
3:  "X-HTTP-Method": "MERGE",  
4:  "IF-MATCH": "*"  
5:  }


Step 6:  Add the below code in Body Textbox

1:  {'__metadata': {'type':'SP.Data.RecordsListItem'},  
2:  'Address':{'Description': 'Click Here','Url': 'https://www.msn.com'}  
3:  }  


Step 7: Replace 'SP.Data.RecordsListItem’ with ListItemEntityTypeFullName of the list. We can use "<Site URL>/_api/web/lists/GetByTitle('<List Name>')?select=ListItemEntityTypeFullName" endpoint to know ListItemEntityTypeFullName for a specific SharePoint List.

Step 8: Replace 'Address' with the name of your  hyperlink column name

Step 9: Replace 'Description' text with the label/description text you want for the link

Step 10: Replace https://www.msn.com with your hyperlink.


Output

When a new item is created in the SharePoint List, the Hyperlink Field value gets populated with Description from Power Automate (with values configured in Power Automate).


Hope this helps!

If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment