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
Resolution
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".
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.
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).
If you have any questions you can reach out our SharePoint Consulting team here.
No comments:
Post a Comment