1

我正在使用 SugarCRM 6.4.4 和 php 5.3.10 并尝试使用肥皂调用将联系人添加到目标列表中......我也尝试过直接使用 ProspectList 类,但我无法让它工作。我知道 SOAP 调用正在通过,因为我可以很好地创建联系人,但是当我尝试创建联系人和目标列表 (PropsectList) 之间的关系时,问题就来了。我究竟做错了什么?

这是我尝试的 SOAP 调用。我收到一条错误消息:“在第 1350 行的 /data/servers/thesite.com/web/administrator/sales/soap/SoapSugarUsers.php 中的非对象上调用成员函数 add()”。 .这是第 1350 行的代码

if (!empty($key)) {
    $mod->load_relationship($key);
    $mod->$key->add($module2_id);
    return $error->get_soap_array();
}

这是 SOAP 的完整代码:

// set up options array
$options = array(
        "location" => 'http://www.thesite.com/sales/soap.php',
        "uri" => 'http://www.sugarcrm.com/sugarcrm',
        "trace" => 1
        );

//user authentication array
$user_auth = array(
"user_name" => 'theuser',
"password" => MD5('thepass'),
"version" => '.01'
);

// connect to soap server
$client = new SoapClient(NULL, $options);

// Login to SugarCRM
$response = $client->login($user_auth,'test');

$session_id = $response->id;

$user_id = $client->get_user_id($session_id);


//Add Contact to SugarCRM
$response = $client->set_entry($session_id, 'Contacts', array(
array('name' => 'first_name','value' => 'roneFirst2'),
array('name' => 'last_name','value' => 'roneLast2'),
array('name' => 'account_name','value' => 'jdam Props'),
array('name' => 'email1','value' => 'roneEmail2@gmail.com'),
array('name' => 'work_phone','value' => '1.888.888.8888'),
array('name' => 'description','value' => 'This is the message'),
array('name' => 'assigned_user_id','value' => $user_id)
));
$contact_id = $response->id;


//Add Contact to TARGET LIST
$relationship = array(
'module1' => 'Contacts',
'module1_id' => "$contact_id",
'module2' => 'ProspectLists',
'module2_id' => "24053784-f8d3-22a4-5e99-4fc6a7d5159f"  //Note: this id was pulled from the table in the database directly for the target list we want to link the contact with.
);

//call set_relationship()
$response = $client->set_relationship($session_id, $relationship);

谷歌搜索并试图解决这个问题已经 3 天了......感谢您愿意提供的任何帮助。

4

0 回答 0