0
votes

I am using Dynamics CRM 2013 On-Premise version.

I am writing the WCF service code for accessing the entity data for external System.

Below is the defined public property in the public class ApplicationDefinition.

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

Lookup is one of the dictionary kind of datatype in CRM.

Now I want to set value for this ProductType but I am getting this error.

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



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

Can anyone please help me on this ?

Thank you, Mittal.

1
LookUp are EntityReference in CRMScorpion

1 Answers

0
votes

Lookup fields are EntityReference type

Types in the Microsoft Dynamics CRM SDK

You can set the field value as below:

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