Jivay
Jivay

Reputation: 1034

SugarCRM get_entry_list returning only 20 entries

I'm using the SugarCRM 6.5.14 SOAP API to retrieve entries from a module to populate a form. My problem is that there are 209 entries in this module but SOAP returns only 20 entries.

I'm using PHP and JS for the AJAX query.

After searching, i found this answer, and even though the get_entries_count returns the correct number of entries, the get_entry_list still returns only 20 entries.

Here's my PHP code :

$soapClient = new SoapClient("http://localhost/sugar/service/v3_1/soap.php?wsdl");

try{
    $info = $soapClient->login(
    array(
        'user_name' => "webservice",
        'password' => md5("MYPASSWORD"),
        )
    );

}catch(SoapFault $fault){
    die("E_CONNECT");
}

$sessid = $info->id;

$max_count = $soapClient->get_entries_count($sessid, "comp_module", "", false);
$soapResponse = $soapClient->get_entry_list($sessid, "comp_module", "", "comp_module.name", array(), $max_count->result_count, false);

$response = Array();
$resellersArray = $soapResponse->entry_list;

foreach($resellersArray as $reseller){

    array_push($response, array("id" => $module->id, "name" => $module->name_value_list[4]->value));
}

echo json_encode($response);

Upvotes: 1

Views: 2325

Answers (1)

Chad Hutchins
Chad Hutchins

Reputation: 484

It looks like you may have some missing parameters in the signature.

It should be:

$soapResponse = $soapClient->get_entry_list($session,$module_name,$query,$order_by,$offset,$select_fields,$link_name_to_fields_array,$link_name,$max_results,$deleted);

So if you change your get_entry_list call to the following, it should respect the max results param:

$soapResponse = $soapClient->get_entry_list($sessid, "comp_module", "", "comp_module.name", 0, array(), array(), $max_count->result_count, false);

Also, if you're on 6.5.14, you should go ahead and use the v4_1 api.

$soapClient = new SoapClient("http://localhost/sugar/service/v4_1/soap.php?wsdl");

Upvotes: 1

Related Questions