[Model-Driven Apps] Learn how to sort Activities and control which fields to show on the Timeline Control in Unified Interface

One of the most common UI requests that I receive from the customers from time to time is to change the sorting order of the activities on the Timeline control (previously known as Social Pane in the legacy web client). By default, the Activities are sorted by Last Updated (modifiedon) date/time, but sometimes, that is not how the customers would like to see the records sorted.

Most of the time, users want to see the activities sorted by based on the activity date or Date Created (createdon) in descending order so that they will see the latest activity on top of the timeline. When the activity records are ordered by Last Updated, the old activity record goes up to the top when one of the users modify the old activity for some reasons (task completion, update description, etc.). It gets more confusing when the main record is assigned to one of the users and all related activities are also assigned to the same owner because of the cascading rule in the relationship. In this scenario, all activities are shown with one single date (the date the main record was assigned) and the records are sorted by the order of how the system triggered the cascading ownership.

In this blog post, I will demonstrate how to change the sort order and display date of the activities on the timeline control on model-driven apps in Dynamics 365 or Common Data Service (CDS). I will use the Date Created (createdon) field as an example, but it can be sorted by any OOB Date/Time field of the activity or by Custom Date fields using Sort Date (e.g. different fields for different entities like Phone Call Due Date, Appointment Actual Start).

Below is my original timeline without any configuration where the activities are being sorted in Last Updated date.

This is the Date Created and Last Updated data of those activities and our goal is to sort the activities on the timeline using the Date Created field and display the same field.

To change the sort order of the activities in the timeline, open the classic form designer > double-click the timeline/social pane control > under Unified Interface Properties (New) tab > Activities sub-tab > change Sort timeline by to Date Created

And voilĂ ! The activities are now sorted by Date Created. I thought it was that easy and all done, but apparently not! The timeline is still displaying the Last Updated beside each activity (except Start Time for Appointment) as default field. This will be confusing for the users when the sort order and the date displayed are not the same.

Changing the field to be displayed in that area is not as easy as changing the sort order. Microsoft has made it configurable for each entity and because of that, the configuration needs to be done for every activity entity. The configuration is not as simple as choosing different fields for different areas (User, Date, Title, Subtitle) and the card form for each entity (including custom activity entities) needs to be selected.

Somehow, there is no option to configure for Letter and Fax. So, if your organisation is still using Letter and Fax, those activities will still display Last Updated value and there is no way to change it.

To display the fields that we want on the activity timeline, we can either update the existing out-of-the-box card form or create a new card form. I recommend creating a new card form for a timeline so that it will not impact how the activities are being displayed as the card form in the other areas of the system.

When the card form is created, there are 4 fields to be added which needs to be in a specific area of the form.

  1. The value for the User (green) comes from the first field (leftmost in the top row) of the header section. (Task entity is the only exception which ignores the first field and always shows the modified by column)
  2. The value for the Date (dark red) comes from the first date/time field after the Name field (above) of the header section. If there is more than one date/time field, the system picks up the topmost and leftmost one.
  3. The value for the Title (blue) comes from the first field of the body.
  4. The value for the Subtitle (red) comes from the second field of the body.

The only exception is the Appointment entity, where the new form cannot be created. (Please go and vote for this idea, if you think you should be able to create a new Appointment form.)
For this case, we have no choice but to edit the existing Appointment card form.
Make sure the Organizer field is the first field in the header followed by the Created On field. The Subject and Description fields are 1st and 2nd fields of the body by default, so no change is required (unless those fields were moved by prior customisation).

After creating/updating the card forms for all activity entities, my timeline control now sorts the activities based on the Date Created field and displays the same field (except for Letter and Fax).

You can find out the official documentation about setting up the timeline control at Microsoft documentation site.

I also found another great blog post within this topic which was written by Arun Vinoth.

In summary, updating the sort order of the activities in the timeline control is easy but updating the displaying fields take a bit of an effort to create/update card forms for each activity entity with a few limitations as below:
  • No option to display using card form for Letter and Fax
  • New card form cannot be created for Appointment entity
  • User field for Task entity is not configurable in the card form
  • The display and sort fields for Notes and Posts are not configurable


Popular Posts