SugarCRM soap调用不将联系人链接到目标列表

时间:2012-06-05 15:56:12

标签: soap sugarcrm

我正在使用SugarCRM 6.4.4和php 5.3.10并尝试使用soap调用将联系人添加到目标列表...我也尝试直接使用ProspectList类但我无法得到它上班。我知道SOAP调用正在通过,因为我可以很好地创建Contact,但是当我尝试创建Contact和Target List(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天了...感谢您愿意给予的任何帮助。

0 个答案:

没有答案