title: Trying to get relationships using SugarCRM API
body: <p>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. </p>
  
  <p>Thanks in advance.  Please let me know if more information is needed.  </p>
  
  <p>I followed this example <a href="http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/02_Application_Framework/Web_Services/Examples/SOAP/PHP/Retrieving_a_List_of_Records_With_Related_Info/" rel="nofollow noreferrer">here</a></p>
  
  <p>My code is as follows </p>
  
  <pre><code>foreach ( $uids as $uid ) {
               //retrieve records -----------------------------------     
                  $get_entries_parameters = array(
  
                       //session id
                       'session' =&gt; $session,
  
                       //The name of the module from which to retrieve records
                       'module_name' =&gt; 'fs_payments',
  
  
                       //An array of SugarBean IDs
                       'ids' =&gt; array(
                          $uid 
                       ),
  
                      'query' =&gt; "",
                      'order_by' =&gt; "",
                      'offset' =&gt; "0",
  
                      'link_name_to_fields_array' =&gt; array(
                          array(
                              'name' =&gt; 'fs_billing_fs_payments_1',
                              'value' =&gt; array(
                                  'first_name',
                                  'qb_studentid'
                              ),
                          ),
                      ),
  
  
  
                  );
  </code></pre>
  
  <p>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. </p>
  
  <pre><code>Linked Fields for fs_payments
  
  fs_billing_fs_payments_1
  [name] -&gt; 'fs_billing_fs_payments_1'
  [type] -&gt; 'link'
  [relationship] -&gt; 'fs_billing_fs_payments_1'
  [module] -&gt; 'fs_billing'
  [bean_name] -&gt; 'fs_billing'
  </code></pre>
  
  <p>Does anyone have a better example than <a href="http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.7/02_Application_Framework/Web_Services/05_Method_Calls/get_entries/" rel="nofollow noreferrer">this</a>(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.  </p>
  
  <pre><code>$get_entries_parameters = array(
   //session id
   'session' =&gt; $session_id,
   //The name of the module from which to retrieve records
   'module_name' =&gt; 'Accounts',
   //An array of record IDs
   'ids' =&gt; array(
       '14b0c0ca-3ea2-0ee8-f3be-50aa57c11ee7',
   ),
   //The list of fields to be returned in the results
   'select_fields' =&gt; 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' =&gt; array(
        array(
             'name' =&gt; 'email_addresses',
             'value' =&gt; array(
                  'email_address',
                  'opt_out',
                  'primary_address'
             ),
        ),
   ),
  //Flag the record as a recently viewed item
  'track_view' =&gt; true,
  );
  </code></pre>