I am trying to pull an individual billing record and some specific fields using SugarCRM's legacy REST API. I am working on SuiteCRM and they use the same legacy REST API calls. I have another foreach similar to this one that does work just fine. The only problem is that this one will only return the requested info and not the relationship I am calling in link_name_to_fields_array.
Thanks in advance. Please let me know if more information is needed.
I followed this example here
My code is as follows
foreach ( $uids as $uid ) {
//retrieve records -----------------------------------
$get_entries_parameters = array(
//session id
'session' => $session,
//The name of the module from which to retrieve records
'module_name' => 'fs_payments',
//An array of SugarBean IDs
'ids' => array(
$uid
),
'query' => "",
'order_by' => "",
'offset' => "0",
'link_name_to_fields_array' => array(
array(
'name' => 'fs_billing_fs_payments_1',
'value' => array(
'first_name',
'qb_studentid'
),
),
),
);
Just did an API call to get all links and I did confirm the link name is what it should be and there is no reason it should be returning an empty array.
Linked Fields for fs_payments
fs_billing_fs_payments_1
[name] -> 'fs_billing_fs_payments_1'
[type] -> 'link'
[relationship] -> 'fs_billing_fs_payments_1'
[module] -> 'fs_billing'
[bean_name] -> 'fs_billing'
Does anyone have a better example than this(shown below as well) as it is not very helpful in my opinion as true relationships/links in the CRM have names such as 'fs_billing_fs_payments_1' and seem to not work as the example shows.
$get_entries_parameters = array(
//session id
'session' => $session_id,
//The name of the module from which to retrieve records
'module_name' => 'Accounts',
//An array of record IDs
'ids' => array(
'14b0c0ca-3ea2-0ee8-f3be-50aa57c11ee7',
),
//The list of fields to be returned in the results
'select_fields' => array(
'name',
'billing_address_state',
'billing_address_country'
),
//A list of link names and the fields to be returned for each link name
'link_name_to_fields_array' => array(
array(
'name' => 'email_addresses',
'value' => array(
'email_address',
'opt_out',
'primary_address'
),
),
),
//Flag the record as a recently viewed item
'track_view' => true,
);