Reputation: 267
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?
Upvotes: 4
Views: 4371
Reputation: 2208
This line about
'link_field_name' => 'accounts_contacts',
should be
'link_field_name' => 'contacts',
since the link field name is 'contacts' ( the relationship name is 'accounts_contacts' ).
Upvotes: 7