2 回答
TA贡献1827条经验 获得超9个赞
您可以使用查询表达式或使用 FetchXML 来查询插件中的记录service.RetrieveMultiple
。例如,您可以使用XrmToolBox FetchXML 构建器构建 fetchxml ,或者只需从 CRM Advanced 查找构建器下载 fetchxml 并在下面的代码示例中使用它。
z
var fetchXml = $@"
<fetch>
<entity name='new_particpiant'>
<attribute name='new_average'/>
<filter type='and'>
<condition attribute='new_particpiant' operator='eq' value='{GUID}'/>
</filter>
</entity>
</fetch>";
EntityCollection entities = service.RetrieveMultiple(new FetchExpression(fetchXml));
TA贡献1827条经验 获得超4个赞
使用查询表达式:
QueryExpression qe = new QueryExpression();
qe.EntityName = "new_particpiant";
ColumnSet columns = new ColumnSet(
new string[1]
{
"new_average",
});
ConditionExpression ce = new ConditionExpression
{
AttributeName = "new_particpiant",
Operator = ConditionOperator.Equal,
Values = { 'Your Guid' }
};
FilterExpression filterQuery = new FilterExpression();
filterQuery.FilterOperator = LogicalOperator.And;
filterQuery.AddCondition(ce);
qe.ColumnSet = columns;
EntityCollection ec = service.RetrieveMultiple(qe);
Entity data = new Entity();
if (ec.Entities.Count > 0)
{
data = ec.Entities[0];
string average = Convert.ToString(data.Attributes["new_average"]);
}
- 2 回答
- 0 关注
- 114 浏览
添加回答
举报