这是我尝试过的代码:
$result = $sugar['soapclient']->call(
'set_entry',
array(
'session'=>$sugar['session'],
'module_name'=>'Accounts',
array(
array("name" => 'id', "value" => $sugar_data['id']),
array("name" => 'name', "value" => $sugar_data['name']),
array("name" => 'description', "value" => $sugar_data['description']),
array("name" => 'team_id', "value" => $sugar_data['team_id']),
array("name" => 'team_set_id', "value" => $sugar_data['team_set_id']),
array("name" => 'phone_fax', "value" => $sugar_data['phone_fax']),
array("name" => 'billing_address_street', "value" => $sugar_data['address_street']),
array("name" => 'billing_address_city', "value" => $sugar_data['address_city']),
array("name" => 'billing_address_state', "value" => $sugar_data['address_state']),
array("name" => 'billing_address_postalcode', "value" => $sugar_data['address_postalcode']),
array("name" => 'billing_address_country', "value" => $sugar_data['address_country']),
array("name" => 'shipping_address_street', "value" => $sugar_data['address_street']),
array("name" => 'shipping_address_city', "value" => $sugar_data['address_city']),
array("name" => 'shipping_address_state', "value" => $sugar_data['address_state']),
array("name" => 'shipping_address_postalcode', "value" => $sugar_data['address_postalcode']),
array("name" => 'shipping_address_country', "value" => $sugar_data['address_country']),
array("name" => 'phone_office', "value" => $sugar_data['phone_work'])
)
)
);
但是,该行不会插入。我根据ID和account_name进行了搜索,并且都返回了0个结果。
谢谢!我真的很感谢你的帮助,因为这将在今天结束时完成!
尼克
答案 0 :(得分:3)
我认为问题在于您在数据中使用了“id”字段。在这种情况下,SugarCRM尝试使用此特定ID更新帐户记录。如果您想创建一个拥有自己ID的帐户,您应该在数组中添加此元素:
array(
'name' => 'new_with_id',
'value' => 1,
),
答案 1 :(得分:1)
网络服务的回复是什么?
尝试调试Web服务调用:
我也会尝试更简单的测试并验证它是否正常工作:
$info = $soapClient->set_entry(
$session,
'Accounts',
array(
array('name' => 'name', 'value' => 'Test account'),
array('name' => 'description', 'value' => 'This is a test account'),
)
);
}
将自动创建ID。