Display Appended Comments Version History From SharePoint List On PowerApps

In this article, we will talk about how we can display appended column version history from SharePoint list to PowerApps canvas App. We can call Flow from PowerApps to get SharePoint Appended Column Version History and display the output in PowerApps.

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.

Display Appended Comments Version History from SharePoint List on PowerApps
My list has a “Comments” column which has column type multiline textbox with rich text and "Append changes to existing text" enabled.
Display Appended Comments Version History from SharePoint List on PowerApps

Below is the result of SharePoint item where we need to show all the comment history in PowerApps.

Display Appended Comments Version History from SharePoint List on 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.

Display Appended Comments Version History from SharePoint List on PowerApps

Step 1 - Create MS Flow to retrieve Append Comment History from SharePoint List

  1. Click on "New flow" and select “Instant – From blank”.

    Display Appended Comments Version History from SharePoint List on PowerApps

  2. Give the name of flow and select “PowerApps” as Triggering.

    Display Appended Comments Version History from SharePoint List on PowerApps

  3. The following step has been created.

    Display Appended Comments Version History from SharePoint List on PowerApps

  4. Now, we need to initialize four variables which accept the value from PowerApps.
Display Appended Comments Version History from SharePoint List on PowerApps

To create the variables, follow the below procedure.

Add an action named “Initialize Variables”.

Display Appended Comments Version History from SharePoint List on PowerApps

It will ask for the following information.

  • Name
  • Type
  • Value
Display Appended Comments Version History from SharePoint List on PowerApps

Now, let’s create the first variable named “AppendComment”.

Display Appended Comments Version History from SharePoint List on PowerApps
Name AppendComment
Type String
Value <div class="ReactFieldEditor-AppendedData"><div>

Create a variable named “Column Name”.

Display Appended Comments Version History from SharePoint List on PowerApps
 
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”.

Display Appended Comments Version History from SharePoint List on PowerApps
Display Appended Comments Version History from SharePoint List on PowerApps

In a similar way, let’s create the third variable named “Site Address”.

Display Appended Comments Version History from SharePoint List on PowerApps
 
Name SiteAddress
Type String
Value Ask in PowerApps / @{triggerBody()['SiteAddress_Value']}

Create a variable named “ListName”.

Display Appended Comments Version History from SharePoint List on PowerApps
 
Name ListName
Type String
Value @{triggerBody()['ListName_Value']}

Create a variable named “ListItemID”.

Display Appended Comments Version History from SharePoint List on PowerApps
 
Name ListItemID
Type Integer
Value @{triggerBody()['ListItemID_Value']}
  • Now, add an action for “Send an HTTP request to SharePoint”.
Display Appended Comments Version History from SharePoint List on PowerApps

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”.
Display Appended Comments Version History from SharePoint List on PowerApps
  • 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.
Display Appended Comments Version History from SharePoint List on PowerApps
  1. {  
  2.     "type""object",  
  3.     "properties": {  
  4.         "value": {  
  5.             "type""array",  
  6.             "items": {  
  7.                 "type""object",  
  8.                 "properties": {  
  9.                     "Comment": {  
  10.                         "type""string"  
  11.                     }  
  12.                 },  
  13.                 "required": ["Comment"]  
  14.             }  
  15.         }  
  16.     }  
  17. }  
  • Click an action “Compose” so that “Apply to each” will be created automatically.
Display Appended Comments Version History from SharePoint List on PowerApps
  • In Compose, create the below formula.
Display Appended Comments Version History from SharePoint List on PowerApps
  1. formatdatetime(items('Apply_to_each')['Modified'],'MM/dd/yyyy hh:mm tt')    
  • Now, add an action “Append to string variable”.
Display Appended Comments Version History from SharePoint List on PowerApps

In name, select the already created variable named “AppendComment”.

  1. concat('<div style="margin-bottom:5px;">',items('Apply_to_each')['Author']  
  2. ['LookupValue'],' (<span style="color: rgb(3, 131,  
  3. 135)">',outputs('Compose'),'</span>)','',items('Apply_to_each')  
  4. [variables('ColumnName')],'</div>')  
  • Add an action named “Respond to PowerApps”.
  • Add an output “Result” and pass “AppendComment” variable.
Display Appended Comments Version History from SharePoint List on PowerApps
  • Our Flow has been created successfully.
  • The overall flow will look like the following screen.
Display Appended Comments Version History from SharePoint List on PowerApps

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.
Display Appended Comments Version History from SharePoint List on PowerApps
 
  • On the Details screen, create a button. I created a button named “View More”.
Display Appended Comments Version History from SharePoint List on PowerApps
  • Go to Action, select Flow. It will show our created Flow.
  • Now, write the following formula in the OnSelect button.
Display Appended Comments Version History from SharePoint List on PowerApps
 
  1. 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.
Display Appended Comments Version History from SharePoint List on PowerApps
  • Select HTML text and go to Advanced Property. Under Data, set HTMLtext as following.

    1. AppendCommentsMore.result  

Display Appended Comments Version History from SharePoint List on PowerApps

Step 3 - Run the PoweApps and test the Application

  • Run PowerApps.
  • Click on "View More".
Display Appended Comments Version History from SharePoint List on PowerApps
  • It will show all the comments.
Display Appended Comments Version History from SharePoint List on PowerApps
  • Now, let’s check the flow history as well.
Display Appended Comments Version History from SharePoint List on PowerApps
  • The flow has been run successfully.
Display Appended Comments Version History from SharePoint List on PowerApps

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 !!!!!