我是新手CRM (version 4.0)
,我正在尝试根据给定的年份(也存储在实体中)返回“yearid”指南。到目前为止,我得到了:
public static Guid GetYearID(string yearName)
{
ICrmService service = CrmServiceFactory.GetCrmService();
// Create the query object.
QueryExpression query = new QueryExpression("year");
ColumnSet columns = new ColumnSet();
columns.AddColumn("yearid");
query.ColumnSet = columns;
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.AddCondition(new ConditionExpression
{
AttributeName = "yearName",
Operator = ConditionOperator.Equal,
Values = new object[] { yearName}
});
query.Criteria = filter;
}
但我的问题是:
A)除此之外还有哪些代码可以实际存储 Guid?
B) 使用 QueryExpression 是最有效的方法吗?