How to set a Lookup value in CRM 2011 with SSIS 2008 ( Framework 3.5)

提議的解答 How to set a Lookup value in CRM 2011 with SSIS 2008 ( Framework 3.5)

  • Tuesday, April 24, 2012 7:12 AM
     
     
     I tried this way and its does not work



     I tried this way and its does not work :

    account.parentaccountid= new Lookup ();

    account.parentaccountid.type = EntityName.account.ToString();

    account.parentaccountid.Value = _accountId;



    Thanks,

All Replies

  • Tuesday, April 24, 2012 7:19 AM
     
     Proposed Answer

    Hi it has changed for CRM 2011,

    you need to pass like this way

    account.parentaccountid= new EntityReference("account", _accountId);


    By Sanz. -- If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".

    • Proposed As Answer by san Sanz Tuesday, April 24, 2012 7:19 AM
    •  
  • Tuesday, April 24, 2012 7:24 AM
     
     
    Yes but he refuses EntityReference, it tells me it is impossible to convert a Lookupin EntityReference.
  • Tuesday, April 24, 2012 7:25 AM
     
     

    im sorry who refused?

    you need add the new sdk dlls and it should be .net framework4.0


    By Sanz. -- If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".

  • Tuesday, April 24, 2012 7:29 AM
     
     
    I also tried with. Net Framework 4.0 but the error is the same: In his definition is of type Lookup parentaccountid and he accepts nothing outside (new Lookup () ;) how to change that ?
  • Tuesday, April 24, 2012 7:34 AM
     
     

    this might be the problem of using CRM 4.0 Class code,please generate the cs file using crmsvcutil.exe


    By Sanz. -- If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".

  • Tuesday, April 24, 2012 7:49 AM
     
     

    What is the syntax to generate the cs file in the command prompt please.
  • Tuesday, April 24, 2012 8:13 AM
     
      Has Code

    if you are running on crm machine you no need to pass authentication

    CrmSvcUtil.exe 
     /out:Xrm.cs 
    /url:http://localhost/organizationName/XRMServices/2011/Organization.svc  /namespace:Xrm 
    /u:username /d:domain /p:password
    http://msdn.microsoft.com/en-us/library/ff681563.aspx


    By Sanz. -- If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".


    • Edited by san Sanz Tuesday, April 24, 2012 8:15 AM
    •