Hi everyone,
I'm new to the Dynamics API and just starting to get my head around how it all works. We have been using the REST API to create accounts and contacts, on creation of the account we are creating the primary contact, which seems to be working OK so far. The hurdle I'm facing is that I'm not sure how to assign the company to the contact.
This is how we are creating the primary contact for the account, however its not automatically linked as a contact for that account.
$response = $this->dn->accounts->insert(array('name'=> $company,'emailaddress1'=> $email,'telephone1'=>$phone,'address1_telephone1'=>$phone,'address1_line1'=>$address1_line1,'address1_line2'=>$address1_line2,'address1_stateorprovince'=>$address1_stateorprovince,'address1_city'=>$address1_city,'address1_postalcode'=>$address1_postalcode,'address1_country'=>$address1_country,'customertypecode'=>'3','primarycontactid'=>array('emailaddress1'=> $email,'mobilephone'=>$phone,'firstname'=>$fname,'lastname'=>$lname,'address1_line1'=>$address1_line1,'address1_line2'=>$address1_line2,'address1_country'=>$address1_country,'address1_city'=>$address1_city,'address1_stateorprovince'=>$address1_stateorprovince,'address1_postalcode'=>$address1_postalcode,'jobtitle'=>$jobtitle,'company'=>$phone)));
I thought nmaybe updating the contact after create parentcustomerid_account would work, but it seems to expect an array? Im lost any help would be greatly appreciated.
$cresponse = $this->dn->contacts->update($co['contactid'], array('emailaddress1'=> 'lmorrow@xxxx.com.au','parentcustomerid_account'=>$account_id));
