In SugarCRM 6.0.0 I need to create a relationship between an Account and a Contact via the REST webservices API.
I have tried these methods in both ways (Account -> Contact, Contact -> Account) to no avail:
$method = 'set_relationship';
$params = array(
'module_name' => 'Accounts',
'module_id' => $accountId,
'link_field_name' => 'accounts_contacts',
'related_ids' => array($userId)
);
$method = 'set_entry';
$params = array(
'module_name' => 'Contacts',
'name_value_list' => array(
array('name' => 'id', 'value' => $userId),
array('name' => 'accounts_contacts', 'value' => $accountId),
),
);
Numerous searches only give me these methods, or SOAP solutions. Anyone who can point me in the right direction?
This line about
should be
since the link field name is ‘contacts’ ( the relationship name is ‘accounts_contacts’ ).