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);
listLinkItem.LinkCriteria.Conditions.Add(condition);
OrderExpression orderBy = new OrderExpression();
orderBy.AttributeName = ?????
orderBy.OrderType = OrderType.Descending;
query.PageInfo = new PagingInfo();
query.PageInfo.Count = 1;
BusinessEntityCollection oMktList = service.RetrieveMultiple(query);