CRM 2011 SDK create to another BU
-
Tuesday, July 10, 2012 2:06 PM
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
-
Tuesday, July 10, 2012 2:48 PMModeratorA lookup in CRM is an entityreference not a Guid. buobject.businessunitid.Value I would think would hold a Guid.
Jamie Miley
Check out my about.me profile!
http://mileyja.blogspot.com
Linked-In Profile
Follow Me on Twitter! -
Tuesday, July 10, 2012 2:51 PMModerator
If you get an error in the specified line, then the error seems to be located in the method GetBU...
Anyway, you seem to be French, you can ask your question in the French forum : http://social.technet.microsoft.com/Forums/fr-FR/1140/threads
Or let Jamie help you, he knows a lot :)
My blog : http://mscrmtools.blogspot.com
Did you try the new CrmDiagTool for Microsoft Dynamics CRM 2011 ? If not, follow me
Upgraded tools for Dynamics CRM 2011!
View Layout Replicator | Searchable Property Updater | Ribbon Browser | SiteMap Editor | JavaScript Web Resource Manager | Role updater -
Tuesday, July 10, 2012 4:42 PM
Hi KMAREC,
"owningbusinessunit" field is not valid for create or update. Unless,the record has been assigned to a user who belongs to another BU, the field value won't change.
Hope it helps ...!! :)
Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"
- Proposed As Answer by vicky_smag (Vikranth Pandiri) Tuesday, July 10, 2012 4:42 PM