currency entity is associated with lead.i'm retrieving associated currency records.but i was unable to get the records.where im doing wrong.could you plz clarify anyone.it has N:N Relationship.below is my code
if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"]) is Entity)
{
Entity en = (Entity)context.InputParameters["Target"];
QueryExpression _Query = new QueryExpression
{
EntityName = "transactioncurrency",
ColumnSet = new ColumnSet(true),
LinkEntities =
{
new LinkEntity
{
Columns=new ColumnSet(true),
LinkFromEntityName="lead",
LinkFromAttributeName="leadid",
LinkToEntityName="new_lead_transactioncurrency",
LinkToAttributeName="transactioncurrencyid",
LinkCriteria=new FilterExpression
{
FilterOperator=LogicalOperator.And,
Conditions=
{
new ConditionExpression
{
AttributeName="transactioncurrencyid",
Operator=ConditionOperator.Equal,
Values={en.Id}
}
}
}
}
}
};
EntityCollection entitycollect = service.RetrieveMultiple(_Query);
int entitycount = entitycollect.Entities.Count;
}
}