你可以帮助我吗?我是使用Javascript进行编程的新手,我需要设置一个联系人与帐户的关系。
function SetRelationContact_Account(){
$.get(CurrentServerAddress + '/service/v2/rest.php', {
method: "set_relationship",
input_type: "JSON",
response_type: "JSON",
rest_data: '{"session":"' + SugarSessionId +
'","module_name":"Contacts","module_id":"' + CurrentContactId +
'","link_field_name":"accounts","related_ids":["session":"' + SugarSessionId +
'"]}'
}, function(data) {
if (data !== undefined) {
var addAccountResult = jQuery.parseJSON(data);
}
});
}
我尝试创建新的联系人,我想设置与现有帐户的关系。 在jmertic的建议中,我尝试了以下方法,但它仍然无效:
function SetRelationContact_Account(){
$.get(CurrentServerAddress + '/service/v2/rest.php', {
method: "set_relationship",
input_type: "JSON",
response_type: "JSON",
rest_data: '{"session":"' + SugarSessionId + '","module_name":"Contacts","module_id":"' + CurrentContactId + '","link_field_name":"accounts","related_ids":["name":"account_id","value":"' + CurrentAccountId + '"]}'
}, function(data) {
if (data !== undefined) {
var addAccountResult = jQuery.parseJSON(data);
}
});
}
答案 0 :(得分:0)
“related_ids”应该是您所关注记录的帐户ID,并且应该是javascript数组的形式。