0

こんにちは、誰かが私を助けることができますか? 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);

       }

   });

}
4

1 に答える 1

0

「related_ids」は関連するレコードのアカウント ID で、javascript 配列の形式である必要があります。

于 2012-07-15T03:41:22.577 に答える