CRM:公共属性 - 无法修改返回值,因为它不是变量

时间:2014-05-01 05:20:23

标签: c# wcf c#-4.0 dynamics-crm

我正在使用Dynamics CRM 2013内部部署版本。

我正在编写WCF服务代码,用于访问外部系统的实体数据。

下面是公共类ApplicationDefinition中定义的公共属性。

  private Lookup _productType;
    public Lookup ProductType
    {
        get { return _productType; }
        set { _productType = value; }
    }

Lookup是CRM中的一种字典数据类型。

现在我想为此ProductType设置值,但我收到此错误。

objApplicationDefinition.ProductType.Value = EntityExtension.GetString(entity, "producttypecode");



Getting Error :  Cannot modify the return value of 'CRM.ApplicationDefinition.ProductType' because it is not a variable.

有人可以帮我吗?

谢谢你, 米塔尔。

1 个答案:

答案 0 :(得分:0)

查找字段是EntityReference类型

Types in the Microsoft Dynamics CRM SDK

您可以将字段值设置如下:

entity["fieldname"] = new EntityReference("entityname", guid);