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.

SolTeferi
Resolver V
Resolver V

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.  

SolTeferi
Resolver V
Resolver V

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.

SolTeferi
Resolver V
Resolver V

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.  

SolTeferi
Resolver V
Resolver V

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

Win free tickets to the Power Platform Conference | Summer of Solutions

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

Celebrating the June Super User of the Month: Markus Franz

Markus Franz is a phenomenal contributor to the Power Apps Community. Super Users like Markus inspire others through their example, encouragement, and active participation.    The Why: "I do this to help others achieve what they are trying to do. As a total beginner back then without IT background I know how overwhelming things can be, so I decided to jump in and help others. I also do this to keep progressing and learning myself." Thank you, Markus Franz, for your outstanding work! Keep inspiring others and making a difference in the community! 🎉  Keep up the fantastic work! 👏👏   Markus Franz | LinkedIn  Power Apps: mmbr1606  

Copilot Cookbook Challenge | Week 1 Results | Win Tickets to the Power Platform Conference

We are excited to announce the "The Copilot Cookbook Community Challenge is a great way to showcase your creativity and connect with others. Plus, you could win tickets to the Power Platform Community Conference in Las Vegas in September 2024 as an amazing bonus.   Two ways to enter: 1. Copilot Studio Cookbook Gallery: https://aka.ms/CS_Copilot_Cookbook_Challenge 2. Power Apps Copilot Cookbook Gallery: https://aka.ms/PA_Copilot_Cookbook_Challenge   There will be 5 chances to qualify for the final drawing: Early Bird Entries: March 1 - June 2Week 1: June 3 - June 9Week 2: June 10 - June 16Week 3: June 17 - June 23Week 4: June 24 - June 30     At the end of each week, we will draw 5 random names from every user who has posted a qualifying Copilot Studio template, sample or demo in the Copilot Studio Cookbook or a qualifying Power Apps Copilot sample or demo in the Power Apps Copilot Cookbook. Users who are not drawn in a given week will be added to the pool for the next week. Users can qualify more than once, but no more than once per week. Four winners will be drawn at random from the total qualifying entrants. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once. If they are drawn multiple times, another user will be drawn at random. Prizes:  One Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value, does not include travel, lodging, or any other expenses) Winners are also eligible to do a 10-minute presentation of their demo or solution in a community solutions showcase at the event. To qualify for the drawing, templates, samples or demos must be related to Copilot Studio or a Copilot feature of Power Apps, Power Automate, or Power Pages, and must demonstrate or solve a complete unique and useful business or technical problem. Power Automate and Power Pagers posts should be added to the Power Apps Cookbook. Final determination of qualifying entries is at the sole discretion of Microsoft. Weekly updates and the Final random winners will be posted in the News & Announcements section in the communities on July 29th, 2024. Did you submit entries early?  Early Bird Entries March 1 - June 2:  If you posted something in the "early bird" time frame complete this form: https://aka.ms/Copilot_Challenge_EarlyBirds if you would like to be entered in the 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. Copilot Cookbook Gallery:Power Apps Cookbook Gallery:1.  @Mathieu_Paris 1.   @SpongYe 2.  @Dhanush 2.   @Deenuji 3.  n/a3.   @Nived_Nambiar  4.  n/a4.   @ManishSolanki 5.  n/a5.    n/a

Your Moment to Shine: 2024 PPCC’s Got Power Awards Show

For the third year, we invite you, our talented community members, to participate in the grand 2024 Power Platform Community Conference's Got Power Awards. This event is your opportunity to showcase solutions that make a significant business impact, highlight extensive use of Power Platform products, demonstrate good governance, or tell an inspirational story. Share your success stories, inspire your peers, and show off some hidden talents.  This is your time to shine and bring your creations into the spotlight!  Make your mark, inspire others and leave a lasting impression. Sign up today for a chance to showcase your solution and win the coveted 2024 PPCC’s Got Power Award. This year we have three categories for you to participate in: Technical Solution Demo, Storytelling, and Hidden Talent.      The Technical solution demo category showcases your applications, automated workflows, copilot agentic experiences, web pages, AI capabilities, dashboards, and/or more. We want to see your most impactful Power Platform solutions!  The Storytelling category is where you can share your inspiring story, and the Hidden Talent category is where your talents (such as singing, dancing, jump roping, etc.) can shine! Submission Details:  Fill out the submission form https://aka.ms/PPCCGotPowerSignup by July 12th with details and a 2–5-minute video showcasing your Solution impact. (Please let us know you're coming to PPCC, too!)After review by a panel of Microsoft judges, the top storytellers will be invited to present a virtual demo presentation to the judges during early August. You’ll be notified soon after if you have been selected as a finalist to share your story live at PPCC’s Got Power!  The live show will feature the solution demos and storytelling talents of the top contestants, winner announcements, and the opportunity to network with your community.  It's not just a showcase for technical talent and storytelling showmanship, show it's a golden opportunity to make connections and celebrate our Community together! Let's make this a memorable event! See you there!   Mark your calendars! Date and Time: Thursday, Sept 19th Location: PPCC24 at the MGM Grand, Las Vegas, NV 

Tuesday Tip | Accepting Solutions

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   To enhance our collaborative environment, it's important to acknowledge when your question has been answered satisfactorily. Here's a quick guide on how to accept a solution to your questions: Find the Helpful Reply: Navigate to the reply that has effectively answered your question.Accept as Solution: Look for the "Accept as Solution" button or link, usually located at the bottom of the reply.Confirm Your Selection: Clicking this button may prompt you for confirmation. Go ahead and confirm that this is indeed the solution.Acknowledgment: Once accepted, the reply will be highlighted, and the original post will be marked as "Solved". This helps other community members find the same solution quickly. By marking a reply as an accepted solution, you not only thank the person who helped you but also make it easier for others with similar questions to find answers. Let's continue to support each other by recognizing helpful contributions. 

Reminder: To register for the Community Ambassador Call on June 13th

Calling all Super Users & User Group Leaders     Reminder: To register for the Community Ambassador Call on June 13th—for an exclusive event for User Group Leaders and Super Users! This month is packed with exciting updates and activities within our community.   What's Happening: Community Updates: We'll share the latest developments and what's new in our vibrant community.Special Guest Speaker: Get ready for an insightful talk and live demo of Microsoft Copilot Studio templates by our special guest.Regular Updates: Stay informed with our routine updates for User Groups and Super Users.Community Insights: We'll provide general information about ongoing and upcoming community initiatives. Don't Miss Out: Register Now: Choose the session that fits your schedule best.Check your private messages or Super User Forum for registration links. We're excited to connect with you and continue building a stronger community together.   See you at the call!  

Top Solution Authors
Top Kudoed Authors
Users online (3,045)