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.
I am wondering if this can be done purely using power pages.
This is a little rough and ready without any customisation - but might give you a rough idea.
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 %}
Hope this helps you get started!
I’d say so! You could do something like the below… just thinking aloud.
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?
Fetch xml or list to render a logged in users messages from the custom table or custom activity
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.
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.
WarrenBelz
9
Most Valuable Professional
Rondel
6
oliver.rodrigues
4
Most Valuable Professional