CRM 2011 SDK create to another BU

Proposed CRM 2011 SDK create to another BU

  • Tuesday, July 10, 2012 2:06 PM
     
      Has Code

    Hello,

    I'm system administrator of CRM and i'm in BusinessUnit "A".
    Using SDK, I would like to create new "partenaire" in BusinessUnit "B".

    Here the code I wrote:

    new_partenaire partenaire = new new_partenaire();
    partenaire.new_name = dic[PARTENAIRE.nom].ToString();
    partenaire.new_id_partenaire = dic[PARTENAIRE.id_partenaire].ToString();
    partenaire.new_description = dic[PARTENAIRE.description].ToString();
    businessunit buObject = GetBU("965FA5B7-AA5B-E111-A7AC-005056AA0025");
    existPartenaire.owningbusinessunit = new Lookup() { Value = buObject.businessunitid.Value };
    
    service.Create(partenaire);

    And i got this Message error in my catch = "Object reference not set to an instance of an object." triggered on businessunit buObject = GetBU("965FA5B7-AA5B-E111-A7AC-005056AA0025"); LINE.

    965FA5B7-AA5B-E111-A7AC-005056AA0025 is the guid id of the BU.

    Thank you in advance

All Replies