Sugar CRM和SOAP API之间的关系

时间:2011-03-01 10:26:11

标签: php soap sugarcrm

您好  我在糖crm中有2个诱饵

  1. 应用
  2. 候选
  3. 申请与候选人有关系。现在我想使用soap api输入数据到候选名称是关系字段的应用程序

    请帮忙

1 个答案:

答案 0 :(得分:2)

我对SugarCRM 5.5的建议。但是,根据您定义的关系类型,可能需要进行一些更改。

<?php
require_once 'nusoap.php';
$sugarClient = new soapclient($myUrl, true);
$response = $sugarClient->login(array('user_name' => $myUser, 'password' => md5($myPass), 'version' => '1'), 'myApp');
$sessionId = $response['id'];

$response = $sugarClient->get_entry_list($sessionId, 'Applications', 'name = '. $myValue, $myOrderBy, 0, array('id'));
$applicationId = $response['entry_list'][0]['id'];

$myCandidate = array(array('key' => $myVal1, 'key2' => $myVal2)); 
$response = $sugarClient->set_entry($sessionId, $myCandidate);
$candidateId = $response['id'];

$myRelation = array('module1' => 'Candidates', 'module1_id' => $candidateId, 'module2' => 'Applications', 'module2_id' => $applicationId);    
$sugarClient->set_relationship($sid, $myRelation);

$sugarClient->logout($sessionId);
?>

有关详细信息,请参阅:http://www.sugarcrm.com/crm/support/documentation/SugarCommunityEdition或搜索google以获取一些示例。