Skip to main content

Notifications

Community site session details

Community site session details

Session Id : l07k/3p25kC/WkrBe7Vm2r
Power Pages - General Discussions
Unanswered

Messaging System Power Pages

Like (1) ShareShare
ReportReport
Posted on 11 Mar 2024 18:11:47 by 4

I am looking to create a messaging system using power pages.  I found this tutorial Create A Portal Inbox & Messaging Process - Megan V. Walker (meganvwalker.com) but it's out of date and I am not sure it works with power pages. 

 

Here are my requirements. 

 

  • A messaging form to send messages to a specific user.
  • An inbox where users can read new messages. 
  • A notification system where users can see how many unread messages they have. 
  • When all messages are read new message notification goes away. 

 

I am wondering if this can be done purely using power pages.

Categories:
  • GWham1 Profile Picture
    on 12 Mar 2024 at 09:24:10
    Re: Messaging System Power Pages

    This is a little rough and ready without any customisation - but might give you a rough idea.

     

    • Created a custom table of type Activity called 'Private Message'
    • Used the out-the-box activity fields e.g. description, regarding, created on.
    • Created an Insert basic form called Private Message surfacing the description/regarding fields.
    • Used Fetch XML to display the results for the current logged-in user where status = Open

    The next stage would be to do the 'mark as read' aspect using the webapi when clicked, or insert a mark as read button per message. I would also create a new field for a contact lookup instead of using the regarding field, so this could be displayed in a dropdown via metadata.

     

     

     {% fetchxml messages %}
     <fetch>
     <entity name="gw_privatemessage">
     <attribute name="activityid" />
     <attribute name="subject" />
     <attribute name="createdon" />
     <attribute name="description" />
     <order attribute="subject" descending="false" />
     <filter type="and">
     <condition attribute="regardingobjectid" operator="eq" value="{{user.id}}" />
     <condition attribute="createdon" operator="ne" value="{{now}}" />
     <condition attribute="statecode" operator="eq" value="0" />
     </filter>
     </entity>
     </fetch>
     {% endfetchxml %}
    
     <div class="message-item">
     <h3>Send a new message</h3>
     {% entityform name:'PrivateMessage' %}
     </div>
    
     <hr/>
    
     {% if messages.results.entities.size > 0 %}
     <h3>You have {{messages.results.entities.size}} unread messages</h3>
     {% for result in messages.results.entities %}
     <div class="message-item">{{ result.description }} <br/> <span>{{result.createdon}}</span></div>
     {% endfor %} 
     {% else %}
     <div class="alert alert-warning">You have no messages</div>
     {% endif %}

     

     

    GWham1_0-1710235034318.png

    GWham1_1-1710235318492.png

    Hope this helps you get started!

  • GWham1 Profile Picture
    on 11 Mar 2024 at 23:16:25
    Re: Messaging System Power Pages

    I’d say so! You could do something like the below… just thinking aloud.

     

    • A messaging form to send messages to a specific user.

    You could use a basic form to submit a record to a custom table or custom activity with status “unread”. Select contact/user from dropdown?

     

    • An inbox where users can read new messages. 

    Fetch xml or list to render a logged in users messages from the custom table or custom activity 

     

    • A notification system where users can see how many unread messages they have. 

    power automate or workflow to create an activity or email notification based on submission or use a schedule to count unread messages every x hours/minutes.

    • When all messages are read new message notification goes away

    Could use web api to update status from “unread” to “read” on click/read of messages or have a button “mark all read” which changes the status.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Pages - General Discussions

#1
WarrenBelz Profile Picture

WarrenBelz 9 Most Valuable Professional

#2
Rondel Profile Picture

Rondel 6

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 4 Most Valuable Professional

Overall leaderboard
Loading started