При попытке для NotIn задать подзапрос
"<detail><error>\n <code>0x80040203</code>\n <description>Condition for attribute 'account.accountid': expected argument(s) of type 'System.Guid' but received 'Microsoft.Crm.Sdk.Query.QueryByAttribute'.</description>\n <type>Platform</type>\n</error></detail>"
Собсно сам код :
ColumnSet cs = new ColumnSet();
cs.Attributes = new string[] { "accountid" };
QueryByAttribute qba = new QueryByAttribute();
qba.ColumnSet = cs;
qba.Attributes = new string[] {"name"};
qba.Values = new object[] {"org1"};
ConditionExpression ce = new ConditionExpression();
ce.AttributeName = "accountid";
ce.Operator = ConditionOperator.NotIn;
ce.Values = new object[] { qba };
FilterExpression fe = new FilterExpression();
fe.Conditions = new ConditionExpression[] {ce};
QueryExpression qe = new QueryExpression();
qe.ColumnSet = new AllColumns();
qe.EntityName = EntityName.account.ToString();
qe.Criteria = fe;
crmService.RetrieveMultiple(qe);
|