This error occurs when using the QueryByAttribute class we are not setting the Attributes and Values Property.
Just like the below code
Say we want to have the names of all the accounts,
ColumnSet myCols=new ColumnSet();
myCols.Attributes=new string[] {“name”};
QueryByAttribute myQA = new QueryByAttribute();
myQA.EntityName = EntityName.account.ToString();
myQA.ColumnSet = myCols ;
BusinessEntityCollection myBCColl2= myService.RetrieveMultiple(myQA);
However we will get error in this case because we haven’t specified Attributes and Values property. So we need to specify those properties.
myQA.Attributes = new String[] { “statuscode” };
myQA.Values=new object[] {“1”};
Otherwise we could use QueryByExpression class for that
ColumnSet myCols=new ColumnSet();
myCols.Attributes=new string[] {“name”};
QueryExpression myQE = new QueryExpression();
myQE.EntityName = EntityName.account.ToString();
myQE.ColumnSet = myCols;
BusinessEntityCollection myBCColl1 = myService.RetrieveMultiple(myQE);
Bye ..
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

Nice quote ,, thanks i got resolved my similar issue
LikeLike