0

我正在开发一个应用程序来下载与 Sugar CRM 中的帐户相关的所有注释和文档。我将其构建为 C# 控制台应用程序,在我的解决方案中使用 Web 服务 API 作为 Web 参考。

我想我已经弄清楚了笔记部分,但我无法弄清楚文档部分。谁能告诉我如何使用 Web 服务 API 调用获取每个帐户的所有文档列表?

我假设我应该使用 get_relationships() 来获取文档,但是如何获取帐户模块 ID?我无权访问数据库。

(我的客户使用的是 Sugar crm 版本 6.7.1 企业版)

4

1 回答 1

2

好的,您应该使用 API get_relationships。请参阅下面的示例。

<?php
$get_relationships_parameters = array(
         'session'=>$session_id,

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

         //The ID of the specified module bean.
         'module_id' => '13111fcd-1884-2a71-0b37-50b7d0f188f6',

         //The relationship name of the linked field from which to return records.
         'link_field_name' => 'documents',

         //The portion of the WHERE clause from the SQL statement used to find the related items.
         'related_module_query' => '',

         //The related fields to be returned.
         'related_fields' => array(
            'id',
            'name',
         ),

         //For every related bean returned, specify link field names to field information.
         'related_module_link_name_to_fields_array' => array(
         ),

         //To exclude deleted records
         'deleted'=> '0',

         //order by
         'order_by' => '',

         //offset
         'offset' => 0,

         //limit
         'limit' => 5,
    );

$get_relationships_result = call("get_relationships", $get_relationships_parameters, $url);
?>

你会看到结果:

stdClass Object
(
    [entry_list] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 8b4c0450-1922-498f-4601-52272fa6e494
                    [module_name] => Documents
                    [name_value_list] => stdClass Object
                        (
                            [id] => stdClass Object
                                (
                                    [name] => id
                                    [value] => 8b4c0450-1922-498f-4601-52272fa6e494
                                )

                            [name] => stdClass Object
                                (
                                    [name] => name
                                    [value] => WebProxyService_A.png
                                )

                        )

                )

        )

    [relationship_list] => Array
        (
        )

)

在 url https://gist.github.com/amusarra/6436845你会找到完整的例子。要获取帐户 ID,应使用 API 或 get_entry get_entries。

我希望我有所帮助。安东尼奥

于 2013-09-04T13:24:17.430 回答