1

我正在使用 SugarCRM 6.5.14 SOAP API 从模块中检索条目以填充表单。我的问题是这个模块中有 209 个条目,但 SOAP 只返回 20 个条目。

我正在使用 PHP 和 JS 进行 AJAX 查询。

搜索后,我找到了这个答案,即使get_entries_count返回正确的条目数,get_entry_list仍然只返回 20 个条目。

这是我的 PHP 代码:

$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);
4

1 回答 1

1

看起来您的签名中可能缺少一些参数。

它应该是:

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

因此,如果您将 get_entry_list 调用更改为以下内容,它应该尊重最大结果参数:

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

此外,如果您使用的是 6.5.14,您应该继续使用 v4_1 api。

$soapClient = new SoapClient("http://localhost/sugar/service/v4_1/soap.php?wsdl");
于 2013-08-29T19:40:26.290 回答