Automate Timeline Posts in Dataverse Model-driven Apps for important events

“Within Dataverse is there a way to have automatic posts to the timeline for events such as entry and exit of stages, change in ownership of the record?“ - of course!

Model-driven apps have this lovely feature called a ‘Timeline’.

NOTE: Post only works for an an environment which has Dynamics 365 installed. If you want to achieved something similar in a non Dynamics 365 environment consider creating a custom activity table which is used to achieve the same timeline update experience.

What’s a ‘Timeline’?

Oxford definition:

“A graphical representation of a period of time, on which important events are marked.”

Model-driven app definition:

“The timeline helps app users see all activity history. The timeline control is used to capture activities like notes, appointments, emails, phone calls, and tasks to ensure that all interactions with the related table are tracked and visible over time. Use the timeline to quickly catch up on all of the latest activity details.”

My definition:

“Like a Facebook or LinkedIn news feed for a specific Dataverse record”

Further reading on Timelines in model-driven apps here.

What’s a ‘Post’?

Timelines are not just for activities and notes though, they also have something called ‘Posts’. There are two types ‘auto’ and ‘manual’. Auto-posts are usually seen when a record is created, or around the Opportunity/Quote/Order side of things in Dynamics 365. Manual ones can be added by users to the timeline (where enabled), they look more like an activity, or a bit like a status update on Facebook.

Lets focus on the auto-post here. Auto-posts are not just for Dynamics 365 automates sales stuff that Microsoft makes for you. You can add your own too.

Add an auto-post to the Timeline using Power Automate

Nothing too fancy here - it’s just a Dataverse record called Post (posts), the way you show the post in the timeline is using our good friend ‘Regarding’.

Action type: Add a new row - Dataverse
Action Name: LeadPost
Table Name: Posts
Source: Auto Post
Text: The message you want to show for the post
Text:: set as null - it never shows anywhere that I found!
Type: Any (see below)
Regarding (Table Name): More details on this here.

Which type of post?

Honestly, I have no idea, I tried creating every type of auto post and to me they look exactly the same so erm yeah, take your pick!

Custom auto-post examples

These will be unique for each business, but here are a couple that I come across often, anduseful across a variety of use cases.

Post when row owner changes

Seeing how an owner or a record (row) has changed over time is handy, it is accessible in the audit history (assuming you have it turned on) but it’s not the easiest to find. So post it on the timeline. To trigger a flow when a row is assigned (aka owner has) changed you can use the Dataverse trigger ‘When a row is added, modified or deleted’ and configure as follows:

Trigger Type: Dataverse - When a row is added, modified or deleted
Trigger Name: Owner Updated
Change type: Modified
Table name: The name of your table you want to post about the owner change
Scope: Organization
Select columns: ownerid

Then we need to get the name of the new owner, but carefully. The owner can be a user or a team so we need to be sure that we do the next get record action using the dynamics inputs from the previous step.

Action Type: Get a row by ID - Dataverse
Action Name
: GetOwner
Table name: @{triggerOutputs()?['body/_ownerid_type']}
Row ID: ⁠@{triggerOutputs()?['body/_ownerid_value']}

The dynamic content will not be available in the next step for the team or user name, however we can ask for the names by use of the expression as shown below in ‘Text’. Only one will ever be populated so adding both values side by side will be seamless from the UK point of view.

Action type: Add a new row - Dataverse
Action Name: LeadPost
Table Name: Posts
Source: Auto Post
Text: owner has been updated to @{body('GetOwner')?['fullname']}@{body('GetOwner')?['teamname']}
Text:: set as null - it never shows anywhere that I found!
Type: Any (see below)
Regarding (Table Name): More details on this here.

Post when a business process flow stage changes

To trigger a flow when a business process flow stage changes you can use the Dataverse trigger ‘When a row is added, modified or deleted’ and configure as follows:

Trigger Type: Dataverse - When a row is added, modified or deleted
Trigger Name: BPF Stage Updates
Change type: Modified
Table name: The name of your business process table
Scope: Organization
Select columns: activestageid
Filter rows: (_activestageid_value ne null)

Then we will get the name of the new stage to add into the post

Action Type: Get a row by ID - Dataverse
Action Name
: GetStageName
Table name: Process Stages
Row ID: ⁠Active Stage (Value)
Select columns: stagename

The compose step is just to show you what variables you can then use to create your auto-post for when a business process flow stage changes. Magic!

Thank you John Bradbury for your question on Make the Activity Timeline Control Useful in Model-Driven Power Apps - it was a handy topic for a blog post!

Happy auto-posting ☺

Previous
Previous

Convert a spreadsheet or CSV file into a Marketing List in Dynamics 365 - Strings

Next
Next

Create sales tasks and phone calls directly from Real-time Dynamics 365 Marketing Journeys