我在动态 crm 表单中与系统用户有多对多关系,并且从以下代码段中,我试图获取在此关系中退出的用户列表。但这会引发异常,即附加信息:'SystemUser' 实体不包含 Name = 'salesorderid' 的属性。.
知道吗,我在其中缺少什么?
private void grabRelatedUsers(IOrganizationService service){
QueryExpression sysUsersQuery = new QueryExpression()
{
EntityName = "systemuser",
ColumnSet = new ColumnSet("systemuserid"),
LinkEntities = {
new LinkEntity() {
LinkFromEntityName = "systemuser",
LinkToEntityName = "new_salesorder_systemuser",
LinkFromAttributeName = "systemuserid",
LinkToAttributeName = "systemuserid",
JoinOperator = JoinOperator.Inner
},
new LinkEntity() {
LinkFromEntityName = "new_salesorder_systemuser",
LinkToEntityName = "salesorder",
LinkFromAttributeName = "salesorderid",
LinkToAttributeName = "salesorderid",
JoinOperator = JoinOperator.Inner,
LinkCriteria = new FilterExpression() {
Conditions = {
new ConditionExpression("salesorderid",ConditionOperator.Equal,orderId)
}
}
},
new LinkEntity().AddLink("systemuser","systemuserid","systemuserid")
},
};
EntityCollection subGridUsers = service.RetrieveMultiple(sysUsersQuery);
}