cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
joshieboy
Post Partisan
Post Partisan

Setup a Threaded Discussion log in PowerApps with version history

Hello,

 

I have an app whereby users can fill out an extensive form, submit and it go through a review process before being approved or rejected.  When a user submits a form, approvers must be able to review and request additional information which allows the form to be reverted to the submitter.  The submitter can update the form based on the info. requested and also add a thread to the discussion saying it was updated or even requesting further clarification etc.  I would like for this threaded discussion to be stored within the app so both parties can see date/time/created by and content of what was asked/answered by both parties.  Any guidance on this appreciated.

7 REPLIES 7
JohnM86
Continued Contributor
Continued Contributor

To implement a threaded discussion within your app, you can create a separate table or collection to store the discussion threads related to each form submission. Here are the high-level steps:

  1. Create a new table or collection in your data source to store the discussion threads. This table should have columns for the following information:

    • Submission ID: the ID of the form submission that the thread is associated with.
    • Thread ID: a unique identifier for the discussion thread.
    • Created By: the name or ID of the user who created the thread.
    • Created Date: the date and time when the thread was created.
    • Content: the text content of the discussion thread.
  2. Add a button or link on the form review screen for approvers to request additional information. When this button is clicked, you can create a new thread in the discussion table using the current submission ID as a reference.

  3. When the submitter updates the form and submits it again, you can retrieve the discussion threads associated with the submission ID and display them on the form review screen. You can also add a new thread to the discussion table to capture any new communication.

  4. To display the threaded discussion, you can use a gallery or table control to show all the threads related to the submission ID. You can also use conditional formatting to highlight the threads created by the approver and the submitter, respectively.

  5. You can add additional features to the discussion, such as the ability to reply to a thread or mark a thread as resolved.

These are the basic steps to implement a threaded discussion in your app. Of course, the actual implementation may vary depending on the specifics of your app and data source.

Hi @joshieboy ,

 

There are 3 main parts involved to build a conversation log/thread:

 

  1. In your datasource (i.e. SharePoint list), create a new list (for this example, I am using "Threads" as the name of this list) and in the list create the following columns:
    1. A person field/column (for this example, I am using "User" as the name of this field)
    2. A rich text column (for this example, I am using "Comments" as the name of this column). A rich text column can contain tens of thousands of characters. If you allow users to type too many content in there, it will potentially slow down your app and datasource. So, limit the number of characters to only few hundreds. You can set that when creating the column)
    3. A number column (For this example, I am using "ParentID" as the name of this column
  2. On the form in Powerapps where users and approvers enter data, do the following:
    1. Insert a custom data card to the form (This will be used to type comments by approvers and users)
    2. Add a rich text editor control to the custom data card (for this example, I am using "RichTextEditor" as the name of the rich text editor)
    3. Set the OnSelect property of the submit button to the following:

 

 

 

UpdateContext({varText:RichTextEditor.HtmlText});   SubmitForm(NameOfYourForm);​

 

 

 

             d. Set the OnSuccess property of the form to the following:

 

 

Patch(Threads,Defaults(Threads),{ParentID:NameOfYourForm.LastSubmit.ID,
User:
 {
Claims: "i:0#.f|membership|" & User().Email,
DisplayName: User().FullName,
Email: User().Email,
Department: "",
JobTitle: "",
Picture: "" },
Comment:varText});​

 

 

 

 

      3. Anywhere (preferably in a new screen) in your Powerapps where you want to display the conversation threads, do the following:

 

  1. Insert two galleries to the screen. (You can insert one gallery nested inside the other. But, that involves a little bit complicated technique if you are not familiar with it. The easier and actually the best way is to insert the galleries side by side (left and right) separate from each other. Make sure you choose a "Flexible height blank gallery" for the right gallery. For this example, I am using "GalleryMain" for name of the left gallery and "GalleryThreads" for the right gallery)
  2. Set the items property of the left gallery as your main SharePoint list name
  3. Set the items property of the right gallery as the following:

 

 

SortByColumns( Filter(Threads,ParentID=Value(GalleryMain.Selected.ID)),"Created_x0020_Date",SortOrder.Descending);​

 

 

 

      d. Insert HtmlText control to the right gallery (For this example, I am using "Htext" as the name of this control). Set the X and Y values of the HTML control to zero.

       e. Set the HtmlText property of the HtmlText control to the following:

 

 

 

"<div style='border-radius:5px; padding:2px; background-color:#dddddd; font-size:14px;'><em>"&ThisItem.User.DisplayName&" - "&ThisItem.Created &"</em></div><div>"&ThisItem.Comment&"</div>" ​

 

 

 

         f. Set the width of the HtmlText control to Parent.Width-10 and set its AutoHeight to True.

 

 

 

         g. Set the Template Size property of the right gallery to: Htext.Height

 

If you follow everything as indicated, you should have a nice looking conversation threads for your app. I recommend to use the exact names of controls used in this example. The only thing you will have to change is the "NameOfYourForm" on step 2, c & d. You have to replace that with the actual name of your form. If you want to change any other name/value, make sure to change all instances as it may be used more than once.

Hi @SolTeferi 

Thank you for the detailed breakdown and explanation of this.  I may have misinterpreted some of step 3, as the previous ones were very clear.  

For Step 2 though, I including the update Context in what was already existing there for me so it reads:

UpdateContext({locIsSubmit:true,varText:RichTextEditor.HtmlText}); SubmitForm(Form1_2);Navigate(FormSubmitted)

 

I did not see any errors there from PowerApps so I assume that was fine.

My OnSuccess as per attached also was fine.  I just had one error as per attached.

 

Re:  Step 3, I inserted the galleries side by side.  Left gallery was set to my main SharePoint List which is the Buyer Pre Qualification Questionnaire - and the right gallery set based on your formula.  As per attached galleryerror, the semicolon to the end was giving the attached errors, and removing it removed the errors.  

I don't know what I am doing wrong here but my "Threads" list in SharePoint is not being updated.  

Hi @joshieboy ,

 

Yes, the way you added the formula in step 2 is fine. Also, it is okay to remove the semi colon at the end of a formula as long as you don't have any more formula added at the end. The semi colon is just a separator between one formula from the next. But I am not sure why your thread list is not updating. I am sure if everything is done correct, it will work.

Did you go in SharePoint to see the actual list to see if it updated or you just looked at the gallery? If you see the actual SharePoint list and it is not updated, the only thing I can think of is spellings of column names (ParentID and User). Also, if you have the default "Title" column. Change its required property to "NO" in SharePoint. I hope that will doit. Let me know.

I just noticed a problem on the submit button that can prevent the threads list from being updated. You have a 'Navigate' function on the OnSelect of the submit button. Remove that "Navigate(FormSubmitted)" from the submit button and put it at the end of the OnSuccess property of the form. Make sure there is a semi colon at the end of the OnSuccess of the form before you add the Navigate function. 

Hello @SolTeferi  - I only just realised you updated this as I was trying several times again following the steps you provided.  I think I have to go through it again from the beginning as I would have made some other changes.  Thanks very much again for this and I will update you later this week once it works for me.  

Hi @joshieboy ,

 

Sure, let me know how it goes. Also, just so you know, there is nothing wrong with the steps I gave you and you don't need to change anything there. What I was talking about in my earlier post is that you had an existing "Navigate" function in your expression. So, you need to remove that navigate function from the submit button and add it to the end of the OnSuccess expression. I hope that make sense. 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages