locked
Retrieving Account information from Potential Customer lookup in Opprtunity Entity RRS feed

  • Question

  • Dear all,

    Anyone can help me please!!!

    I am creating a plugin fo the Opportunity Entity which will have to retrieve information based on the Potential Customer lookup field.

    I am getting an error on the following line of code:
    Lookup lookupAccount = (Lookup)entity.Properties["customerid"];

    The error is as follow below:
    'Microsoft.Crm.Sdk.Customer' to type 'Microsoft.Crm.Sdk.Lookup'.

    Anyone can help me please???

    Many Thanks
    Thursday, February 4, 2010 3:56 PM

Answers

  • try replacing the code as below..

    if(entity.Properties.Contains("customerid"))
    {
    Customer customAccount = (Customer)entity.Properties["customerid"];
    
    if(customAccount.type.Equals(EntityName.account.ToString()))
    {
      //customAccount.Value  will be your account id
    }
    
    }
    
    
    Thursday, February 4, 2010 4:11 PM
    Answerer