Overview
Sometimes, there is a situation when the client wishes to see all the version history for an appended multiline textbox in PowerApps. In this article, we will talk about how we can easily get the version history for appended multiline textbox within the PowerApps.
Please refer to the following list structure I have in SharePoint List.
My list has a “Comments” column which has column type multiline textbox with rich text and "Append changes to existing text" enabled.
Below is the result of SharePoint item where we need to show all the comment history in PowerApps.
There is no direct way to display Appended Column Version History in PowerApps in "Out of the Box" manner. However, we can achieve this functionality using a Microsoft Flow and PowerApps combination.
At the end of the article, you will be able to see the version history within the PowerApps something like this.
Step 1 - Create MS Flow to retrieve Append Comment History from SharePoint List
- Click on "New flow" and select “Instant – From blank”.
- Give the name of flow and select “PowerApps” as Triggering.
- The following step has been created.
- Now, we need to initialize four variables which accept the value from PowerApps.
To create the variables, follow the below procedure.
Add an action named “Initialize Variables”.
It will ask for the following information.
Now, let’s create the first variable named “AppendComment”.
Name
|
AppendComment
|
Type
|
String
|
Value
|
<div class="ReactFieldEditor-AppendedData"><div>
|
Create a variable named “Column Name”.
Name
|
ColumnName
|
Type
|
String
|
Value
|
Ask in PowerApps / @{triggerBody()['ColumnName_Value']}
|
Now, here in Value, we need a parameter from PowerApps. So, when we click on the value, from the right side, select “Dynamic Content” and click on “Ask in PowerApps”. Sometimes, if PowerApps don’t show this option, then click on “See More” and select “Ask in PowerApps”.
In a similar way, let’s create the third variable named “Site Address”.
Name
|
SiteAddress
|
Type
|
String
|
Value
|
Ask in PowerApps / @{triggerBody()['SiteAddress_Value']}
|
Create a variable named “ListName”.
Name
|
ListName
|
Type
|
String
|
Value
|
@{triggerBody()['ListName_Value']}
|
Create a variable named “ListItemID”.
Name
|
ListItemID
|
Type
|
Integer
|
Value
|
@{triggerBody()['ListItemID_Value']}
|
- Now, add an action for “Send an HTTP request to SharePoint”.
Add the following information.
SiteAddress
|
URL of SharePoint Site
|
Method
|
GET
|
Uri
|
/_api/web/lists/GetByTitle('@{variables('ListName')}')/Items(@{variables('ListItemID')})/Versions
|
Headers
|
Accept application/json; odata=nometadata
|
- Add an action to “Parse JSON”.
- Add Content, select Body as result there. We need to parse a comment from the value. So, we will add the following thing as schema.
- {
- "type": "object",
- "properties": {
- "value": {
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "Comment": {
- "type": "string"
- }
- },
- "required": ["Comment"]
- }
- }
- }
- }
- Click an action “Compose” so that “Apply to each” will be created automatically.
- In Compose, create the below formula.
- formatdatetime(items('Apply_to_each')['Modified'],'MM/dd/yyyy hh:mm tt')
- Now, add an action “Append to string variable”.
In name, select the already created variable named “AppendComment”.
- concat('<div style="margin-bottom:5px;">',items('Apply_to_each')['Author']
- ['LookupValue'],' (<span style="color: rgb(3, 131,
- 135)">',outputs('Compose'),'</span>)',': ',items('Apply_to_each')
- [variables('ColumnName')],'</div>')
- Add an action named “Respond to PowerApps”.
- Add an output “Result” and pass “AppendComment” variable.
- Our Flow has been created successfully.
- The overall flow will look like the following screen.
Now, let’s trigger the MS Flow from PowerApps.
Step 2: Call MS Flow from PowerApps by Passing the Parameters
- I already have a SharePoint list shown in PowerApps.
- On the Details screen, create a button. I created a button named “View More”.
- Go to Action, select Flow. It will show our created Flow.
- Now, write the following formula in the OnSelect button.
- Set(AppendCommentsMore,GetAllversions.Run("Comment","https://xyz8.sharepoint.com/sites/PowerApps","AppendedTextSample",SPAppendText.Selected.ID))
Here, in Set function, the variable named “AppendCommentsMore” has been created. It will run our flow and pass 4 parameters as an argument.
- Columnname = Comment
- Site URL
- ListName
- ItemId
- Add an HTML Textbox to show the end result.
- Select HTML text and go to Advanced Property. Under Data, set HTMLtext as following.
- AppendCommentsMore.result
Step 3 - Run the PoweApps and test the Application
- Run PowerApps.
- Click on "View More".
- It will show all the comments.
- Now, let’s check the flow history as well.
- The flow has been run successfully.
This is how we can easily get SharePoint Appended Column Version History in PowerApps.
Conclusion
I hope you love this article. If you do, don’t forget to follow me for more amazing articles on PowerApps. Stay connected with me for more articles.
Happy PowerApping !!!!!