0

REST API v4_1 を使用して、すべてのアカウント関連の連絡先を取得する際に問題があります。SuiteCRM を使用しています。

テーブル構造からわかるように、連絡先の ID を含むテーブル account と accounts_contacts があります。このコードを使用して、ログインしているユーザーに関連するすべてのアカウントを取得します。

$get_entry_parameters = array
        (
            //session id
            'session' => $this->session_id,

            //The name of the module from which to retrieve records
            'module_name' => "Accounts",

            //The ID of the record to retrieve.
            //'id' => NULL,

            //Where conditions without "where" keyword
            'query' => "accounts.assigned_user_id='" . $this->user_id . "'",

            //Sort result by
            'order_by' => NULL,

            //offset
            'offset'  => 0,

            //The list of fields to be returned in the results
            'select_fields' => array( 'id'),

            //optional
            'link_name_to_fields_array' => array(array()),

            //Max number of results to list
            'max_results' => 20,

            'deleted' => false
        );

        $response = $this->call("get_entry_list", $get_entry_parameters);

次に、これらのアカウントのそれぞれについて、関連する連絡先を取得したいと思いますが、どうすればそれができるかわかりません。

4

1 に答える 1

0

何がうまくいかなかったのかわかりませんが、このコードは現在、私が望むものを生成しています。関連データの戻りフィールドの値を適切に定義していませんでした。それらを配列で定義する必要がありました。これが唯一の問題だったと思います。他の誰かが別の問題を発見した場合は、私に知らせてください.

function account_data()
    {
        $get_entry_parameters = array
        (
            //session id
            'session' => $this->session_id,

            //The name of the module from which to retrieve records
            'module_name' => "Accounts",

            //The ID of the record to retrieve.
            //'id' => NULL,

            //Where conditions without "where" keyword
            'query' => "accounts.assigned_user_id='" . $this->user_id . "'",

            //Sort result by
            'order_by' => NULL,

            //offset
            'offset'  => 0,

            //The list of fields to be returned in the results
            'select_fields' => array('id', 'name'),

            //optional
            'link_name_to_fields_array' => array(
                array(
                    'name' => 'contacts',
                    'value' => array('id', 'name')
                )
            ),

            //Max number of results to list
            'max_results' => 20,

            'deleted' => false
        );

        return $response = $this->call("get_entry_list", $get_entry_parameters);
}
于 2015-06-08T10:26:13.310 に答える