1

On the Activities tab of the Contacts screen, I am pulling activity data from an outside source and creating corresponding Acumatica activities. This activity creation is a periodically schedule process, so the activities are not created real-time. Therefore the CreatedDateTime field for the external activities does not reflect the actual time that the activities happened.

However, I need these external activities to be sorted according to when they actually occurred (not according to when they were created in Acuamtica) and to be displayed in proper sequence relative to existing Acuamtica activities. But the Activities view for the Contacts graph is sorted by CreatedDateTime, so these activities are being displayed according to Acuamtica creation time not their actual time.

I can think of two possible solutions, but I cannot see a way to accomplish either one.

1. Set the CRActivity.CreatedDateTime field to be the actual activity time. If we could set the Created Date Time to be the actual time of the activity, the default sort order for the Activities tab would correctly display the external activities in sequence of when they actually occurred. However, this field is a default system field, and I do not see a good way to force it to be anything other than the time the Acumatica object is persisted. Is there any way to specify a value for the CreatedDateTime field?

2. Modify the default sort order of the Activities tab. We can set the StartDate of the new activities to be the actual time that they occurred. So if we could order the Activities grid by Start Date rather than by Created Date Time, that would also achieve the desired affect. If the Activities view were a straightforward PXSelect, we could simply create a new PXSelect statement with the order by we want in our graph extension and use that as the data member for the grid. However, the Activities view is not simple and the OrderBy is buried inside the GenerateOriginalCommand method of the CRActivityListBase class. Is there anyway to override this OrderBy in way that takes advantage of all the functionality of CRActivityListBase?

Is there an acceptable way to use either of these approaches, or is there an alternative approach that would display the activities sorted by actual time?

4

1 回答 1

1

OrderByNew您可以使用如下方式替换排序。

public class ContactMaintPXExt : PXGraphExtension<ContactMaint>
{
    public override void Initialize()
    {
        Base.Activities.OrderByNew<OrderBy<Desc<CRActivity.startDate>>>();
    }
}
于 2019-02-15T22:25:07.650 回答