2012-07-13 106 views
0

嗨,有人能幫助我嗎?我是使用Javascript進行編程的新手,我需要將聯繫人設置爲帳戶關係。如何創建聯繫人和帳戶SugarCRM之間的關係javascript

​​

我試着創建新的聯繫人,我想設置與現有帳戶的關係。 在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

「related_ids」應該是你與記錄的賬號,並應在JavaScript形式陣列。

+0

@MichelangeloMik:發佈新代碼的最佳地點,您嘗試過的是對原始問題的更新。在這種情況下,我已經爲你做了。問題標籤區域下方的「編輯」鏈接可讓您編輯您的問題。歡迎來到stackoverflow! – stanri 2012-07-17 06:41:37

相關問題