Reputation: 191
Im using dynamics crm 2013 and sdk. I wrote code below and try to getting all column for entities but doesnt work.
And my second problem is that I want to getting one column for example "new_onaysayisi" but return column is "contactid" .
public static List<Entity> GetEntityList(string entityName, int memberType)
{
GetOrganisationService();
var query = new QueryExpression
{
EntityName = entityName,
ColumnSet =new ColumnSet("new_onaysayisi"),
Criteria = new FilterExpression { FilterOperator = LogicalOperator.And },
};
query.Criteria = new FilterExpression();
query.Criteria.Conditions.Add
(
new ConditionExpression("new_uyelikturu", ConditionOperator.Equal, memberType)
);
var entities = _service.RetrieveMultiple(query).Entities.ToList();
return entities;
}
Something is wrong but i couldnt find the solution.
Where am i wrong? Thanks for help.
public static List<Entity> GetEntityList(string entityName, int memberType)
{
GetOrganisationService();
var cs = new ColumnSet { AllColumns = true };
var query = new QueryExpression
{
EntityName = entityName,
ColumnSet =cs,
Criteria = new FilterExpression { FilterOperator = LogicalOperator.And },
};
query.Criteria = new FilterExpression();
query.Criteria.Conditions.Add
(
new ConditionExpression("new_uyelikturu", ConditionOperator.Equal, memberType)
);
var entities = _service.RetrieveMultiple(query).Entities.ToList();
return entities;
}`
Upvotes: 1
Views: 838
Reputation: 17562
Its probably because the values are not populated.
In your first example the id
of the primary entity is always returned. I would suspect new_onaysayisi
is not being returned because it is not populated.
In the second example, the AllColumns
code looks good, but again you only get the columns back that are actually populated.
If you use entity.GetAttributeValue
, that will either return a value or null, which can make it easier to work with records.
Upvotes: 1