get_relationsips return empty result set in sugarcrm

180 views Asked by At

Hi i am building an external application interacting with the SuiteCRM using REST API. I have created a module "franchise" which would have many leads in it, so created a one to many relationship between franchise and leads. Now i am trying retrieve a lead record and the franchise associated to it. But I get an empty result. Here's my code:

$get_franchise_lead_parameters = array(
            'session'=>$sessionID,
            'module_name'=>'Leads',
            'module_id'=>$_GET['leadid'], //the id of the specific lead record. 
            'link_field_name'=>'wbur_franchise_leads_1',
            'related_fields'=>array(
                    'id',
                    'name',
                    ),
            'deleted' => '0',
            );
            $get_franchise_lead = call('get_relationships',$get_franchise_lead_parameters, $url);

I get the following result:

stdClass Object ( [entry_list] => Array ( ) [relationship_list] => Array ( ) )

I have tried using the get_entry_list call also, but i don't get any details in the relationship_list tied to each Lead record.

Could any one please help me...!! I have been trying this from two days.

1

There are 1 answers

0
user2720828 On BEST ANSWER

I got my answer from the SuiteCRM forum. We could get the relationships by using the following parameters:

$get_franchise_lead_parameters = array(
                        'session'=>$sessionID,
                        'module_name'=>'Leads',
                        'module_id'=>$lead,
                        'link_field_name'=>'name of the linked field',
                        'related_module_link_name_to_fields_array' => array(),
                        'related_fields' => array(
                                    'id',
                                    'name',
                                    ),
                        'deleted' => '0',
                    );