get_relationships
Overview
Retrieves a specific relationship link for a specified record.
Available APIs
Definition
get_relationships(session, module_name, module_id, link_field_name, related_module_query, related_fields, related_module_link_name_to_fields_array, deleted, order_by, offset, limit)
Parameters
Name |
Type |
Description |
session |
String |
Session ID returned by a previous login call. |
module_name |
String |
The name of the module from which to retrieve records. Note: This is the modules key which may not be the same as the modules display name. |
module_id |
String |
The ID of the specified module record. |
link_field_name |
String |
The name of the link field for the related module. |
related_module_query |
String |
The list of related record IDs you are relating |
related_fields |
select_fields | Array |
An array specifying relationship fields to populate. An example of this is contact_role between Opportunities and Contacts. |
related_module_link_name_to_fields_array |
link_names_to_fields_array | Array |
For every related record returned, specify link field names to field information. |
deleted |
Integer |
|
order_by |
String |
The SQL ORDER BY clause without the phrase "order by". |
offset |
Integer |
The record offset from which to start. |
limit |
Integer |
The maximum number of results to return. |
Result
Name |
Type |
Description |
result |
get_entry_result_version2 | Array |
The call result. |
result.entry_list |
Array |
The record's name-value pair for the simple datatypes excluding the link field data. If you do not have access to the object, entry_list[].name_value_list will notify you. |
result.relationship_list |
Array |
The records link field data. |
Change Log
Version |
Change |
v3 |
Added order_by parameter. |
v2 |
Removed related_module parameter. |
v2 |
Added link_field_name parameter. |
v2 |
Added related_fields parameter. |
v2 |
Added related_module_link_name_to_fields_array parameter. |
v2 |
Return type was changed from get_relationships_result to get_entry_result_version2. |
Examples
PHP
$get_relationships_parameters = array(
//session id
'session' => $session_id,
//The name of the module from which to retrieve records.
'module_name' => 'Accounts',
//The ID of the specified module bean.
'module_id' => '9f0c0ceb-c512-7103-9456-50aa5787c3f6',
//The relationship name of the linked field from which to return records.
'link_field_name' => 'opportunities',
//The portion of the WHERE clause from the SQL statement used to find the related items.
'related_module_query' => " opportunities.name IS NOT NULL ",
//The related fields to be returned.
'related_fields' => array(
'id',
'name'
),
//For every related bean returned,
//specify link field names to field information.
'related_module_link_name_to_fields_array' => array(
array(
'name' => 'contacts',
'value' => array(
'id',
'first_name',
'last_name',
),
),
),
//To exclude deleted records
'deleted'=> 0,
//order by
'order_by' => ' opportunities.name ',
//offset
'offset' => 0,
//limit
'limit' => 200,
);