public static EntityCollection GetTasksInOpportunity(IOrganizationService crmService, Guid opportunityid, ColumnSet columnset)
{
try
{
QueryExpression sorgu = new QueryExpression()
{
EntityName = "task",
ColumnSet = columnset,
NoLock = true,
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression("activitytypecode",ConditionOperator.Equal,4214),
}
},
LinkEntities =
{
new LinkEntity
{
LinkFromEntityName="task",
LinkFromAttributeName="regardingobjectid",
LinkToEntityName = "opportunity",
LinkToAttributeName = "opportunityid",
LinkCriteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression("opportunityid",ConditionOperator.Equal,opportunityid)
}
}
}
}
};
EntityCollection ec = crmService.RetrieveMultiple(sorgu);
if (ec != null && ec.Entities.Count > 0)
return ec;
else
return new EntityCollection();
}
catch (Exception ex)
{
throw ex;
}
}
Hiç yorum yok:
Yorum Gönder