如何在两个模块帐户和联系人之间设置相关性

时间:2013-04-01 09:52:02

标签: php soap sugarcrm

我有以下函数,它使用方法“set_relationship”SOAP方法

设置关系
public function setrelationship() {
    $arr = array(
        "session" => $_SESSION['crm_sessionID'],
        'set_relationship_value' => array(
            "module_`entname" => 'Contacts',
            "id" => '667c8f2f-0fa7-d62f-350a-515447ae9054',
            "module_name" => 'Accounts',
            "module_id" => 'dd3a6387-e2e4-1ae6-4c37-515931596121'
        )
    );

    $res = $this->client->call('set_relationship', $arr);
    print_r($arr);

    return $res;
}

1 个答案:

答案 0 :(得分:1)

您应该按照以下模式来定义关系参数:

public function setrelationship() {
$arr= array(
  'session'=> $_SESSION['crm_sessionID'],
  'set_relationship_value'=>array(
  'module1'=>'Contacts',                                        //primary module
  'module1_id'=>667c8f2f-0fa7-d62f-350a-515447ae9054,           //primary module id
  'module2'=>'Accounts',                                        //secondary module
  'module2_id'=>'dd3a6387-e2e4-1ae6-4c37-515931596121'          //secondary module id
  )
 ); 
$res = $client->call('set_relationship', $arr);

    return $res;
}