History Subpanel Email Date Sent/Received Sort Problem

Hey Guys,

in v7.13.4, I have added the code below to “custom/modules/Emails/metadata/subpanels/ForHistory.php” to add a column in the history subpanel to show the date sent/received for emails.

    'date_sent_received' => [
        'vname' => 'Date Sent/Received',
        'width' => '10%',
        'sortable' => true,
        'default' => true,

It works and shows the right date.

The problem:
when sorting, it doesn’t sort it properly. it shows some of the new emails under the older ones.

2023-09-08 21 22 30

anybody has found a solution for this? or can anyone help me find a solution?
sorting emails are very important especially when there are 30 or so emails connected to a record.

For my case, I relate the emails to projects through the “Related To” field.

I would appreciate it very much if somebody can help me figure this out!

Set the CRM logs to Debug, and then check the query after applying this sorting. hopefully you will get some hint.