Showing results for 
Search instead for 
Do you mean 

Sorting Opportunity Products

Copper Contributor
Posts: 21
Country: United Kingdom

Sorting Opportunity Products

I need to sort a list of Opportunity Products.


If I call GetProducts for the current Opportunity, I get 4 items. So far so good.


    Dim OpportunityProductList As Act.Framework.CustomEntities.CustomEntityList(Of Act.Framework.Opportunities.OpportunityProduct)

    OpportunityProductList = _Act.Instance.ApplicationState.CurrentOpportunity.GetProducts(Nothing)


However, if I try and sort the records by creation date, I don't get any records returned.


    Dim ProductField As Act.Framework.ComponentModel.DBFieldDescriptor
    Dim Sort() As SortCriteria

    ProductField = _Act.Instance.ActFramework.Products.GetFieldDescriptor("CREATEDATE")
    Sort = New SortCriteria() {New SortCriteria(ProductField, System.ComponentModel.ListSortDirection.Descending)}
    OpportunityProductList = _Act.Instance.ApplicationState.CurrentOpportunity.GetProducts(Sort)


Any ideas?