Order By In LinkEntity Query RRS feed

  • Question

  • Hi there,

    Below is the code i am using to select the top one record from CampaignActivity. Now i want to order the result by CampaignActivityItem.CreatedOn field which is the linkentity.

    and if i just specify CreatedOn system does not understand which table i am trying to order it by

    QueryExpression query = new QueryExpression();
    query.EntityName = EntityName.campaignactivityitem.ToString();
    ColumnSet cols = new ColumnSet(new string[] { "campaignactivityid" });
    LinkEntity listLinkItem = query.AddLink(EntityName.campaignitem.ToString(), "itemid", "entityid", JoinOperator.Inner);
    listLinkItem.LinkCriteria = new FilterExpression();
    ConditionExpression condition = new ConditionExpression("campaignid", ConditionOperator.Equal, CampaignId);
    OrderExpression orderBy = new OrderExpression();
    orderBy.AttributeName = ?????
    orderBy.OrderType = OrderType.Descending;
    query.PageInfo = new PagingInfo();
    query.PageInfo.Count = 1;
    BusinessEntityCollection oMktList = service.RetrieveMultiple(query);
    Wednesday, May 13, 2009 8:59 PM


  • Dont worry about this guys. I got this done.

    Thanks alot!
    Thursday, May 14, 2009 1:28 PM