Dear all ,
string subjectmatrixid = string.Empty;
object oVal = null;
bool ismappedcategory = true;
// CrmServiceAdapter OrgService=new CrmServiceAdapter();
SchemaMappingController mappingController = new SchemaMappingController();
QueryExpression queryExpression = new QueryExpression("icms_icmssubjectmatrixmapping");
queryExpression.LinkEntities.Add(new LinkEntity("icms_icmssubjectmatrixmapping", "ava_subjectmatrix", "icms_subcategory", "ava_subjectmatrix_subjectname", JoinOperator.Inner));
// queryExpression.LinkEntities[0].LinkCriteria.AddCondition("ava_subjectmatrix_categoryname", ConditionOperator.Equal, icms_category);
queryExpression.LinkEntities[0].EntityAlias = "Link";
queryExpression.Criteria.Conditions.Add(new ConditionExpression("icms_msoswitchboardcategory", ConditionOperator.Equal, (object)switchboardCategory));
queryExpression.Criteria.Conditions.Add(new ConditionExpression("icms_msoswitchboardsubcategory", ConditionOperator.Equal, (object)switchboardSubcategory));
queryExpression.Criteria.Conditions.Add(new ConditionExpression("icms_ismappedcategory", ConditionOperator.Equal, (object)ismappedcategory));
queryExpression.LinkEntities[0].Columns = new ColumnSet("ava_subjectmatrixid", "ava_subjectmatrix_subject");
//queryExpression.AddOrder("Link.ava_subjectmatrixid", OrderType.Descending);
EntityCollection entitiesJS1 = CrmServiceAdapter.OrgService.RetrieveMultiple(queryExpression);
ICMSLogHelper.LogCreateMisroutedCaseCCMP_SOAPRequest("subjemtmatrixJSid", entitiesJS1.Entities.Count().ToString(), "", ConfigurationManager.AppSettings["LogType"]);
if (entitiesJS1.Entities.Count > 0)
{//int i = 0;
if (entitiesJS1.Entities[0].Contains("Link.ava_subjectmatrix_subject"))
oVal = entitiesJS1.Entities[0].GetAttributeValue<AliasedValue>("Link.ava_subjectmatrix_subject").Value;
subjectmatrixid = ((EntityReference)oVal).Id.ToString();
ICMSLogHelper.LogCreateMisroutedCaseCCMP_SOAPRequest("ava_subjectmatrix_subject", subjectmatrixid, "", ConfigurationManager.AppSettings["LogType"]);
}
return subjectmatrixid;
"queryExpression.AddOrder("Link.ava_subjectmatrixid", OrderType.Descending);" this line throwing error
saying the entity icms_icmssubjectmatrixmapping doesnt have the column name "Link.ava_subjectmatrixid"
how to achive the LinkEntity columns order by ???
please help ??
*This post is locked for comments