Quantcast
Channel: Sam's Activities
Viewing all articles
Browse latest Browse all 3363

Link new Account in new Contact

$
0
0

I am creating a Contact in MSCRM and want to set a new account that I am creating the Contact entity Account field.

The Contact creates right, the account also, but I can not link the account created in Contact.

conexaocrm string = "Url = http: // intranet: 5555 / Training: Username = admin, password = admin @ 15";
                            Microsoft.Xrm.Client.CrmConnection connection = Microsoft.Xrm.Client.CrmConnection.Parse (conexaocrm);

                            using (Microsoft.Xrm.Client.Services.OrganizationService orgService = new Microsoft.Xrm.Client.Services.OrganizationService (connection))
                            {
                                Entity contact = new Entity ( "contact");
                                contact [ "firstname"] = name;
                                contact [ "lastname"] = name;
                                contact [ "new_cpf"] = cpf;
                                contact [ "emailaddress1"] = email;
                                contact [ "telephone1"] = tel_comercial;
                                contact [ "birthdate"] = Convert.ToDateTime (dt_nascimento);
                                Guid = ContactID orgService.Create (contact);

                                Entity account = new Entity ( "account");
                                account [ "name"] = "Test Account";
                                Guid = accountId orgService.Create (account);

                                EntityReference EntityReference parentcustomerId = new ( "account", accountId);
                                account [ "parentcustomerid"] = parentcustomerId;

                            }

Tank You


Viewing all articles
Browse latest Browse all 3363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>