Is there a way to call rest /history/activity-instance with ordering according to actual execution (for a particular processInstanceId)?
I see that this is exposed as orderPartiallyByOccurrence() in the engine, but cannot find anything similar in rest.
Assuming you have at most one < 1 ms task in a local chain, the following is a workaround we currently use: ordering by starttime ascending and then endtime ascending
Hi, thanks for the suggestion, but unfortunately that does not work. We use this to lay out the execution order of a historic process so the workaround in my original post should be sufficient for now.
(for reference, workaround using .net Camunda.Api.Client is
.Sorting = new List<SortingInfo<HistoricActivityInstanceQuerySorting>>() { new SortingInfo<HistoricActivityInstanceQuerySorting>() { SortBy = HistoricActivityInstanceQuerySorting.StartTime, SortOrder = SortOrder.Ascending }, new SortingInfo<HistoricActivityInstanceQuerySorting>() { SortBy = HistoricActivityInstanceQuerySorting.EndTime, SortOrder = SortOrder.Ascending } };
Update: The above workaround breaks for currently running activities as these have endtime == DateTime.MinValue. Ordering client-side gets around this:
var itemsunordered = client.History.ActivityInstances.Query(somequery).List().Result;
var itemsordered = itemsunordered.OrderBy(a => a.StartTime).ThenBy(a => a.EndTime == DateTime.MinValue ? DateTime.MaxValue : a.EndTime);