dsxi70423 2014-12-29 18:08
浏览 62
已采纳

尝试使用SugarCRM API获取关系

I am trying to pull an individual billing record and some specific fields using SugarCRM's legacy REST API. I am working on SuiteCRM and they use the same legacy REST API calls. I have another foreach similar to this one that does work just fine. The only problem is that this one will only return the requested info and not the relationship I am calling in link_name_to_fields_array.

Thanks in advance. Please let me know if more information is needed.

I followed this example here

My code is as follows

foreach ( $uids as $uid ) {
             //retrieve records -----------------------------------     
                $get_entries_parameters = array(

                     //session id
                     'session' => $session,

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


                     //An array of SugarBean IDs
                     'ids' => array(
                        $uid 
                     ),

                    'query' => "",
                    'order_by' => "",
                    'offset' => "0",

                    'link_name_to_fields_array' => array(
                        array(
                            'name' => 'fs_billing_fs_payments_1',
                            'value' => array(
                                'first_name',
                                'qb_studentid'
                            ),
                        ),
                    ),



                );

Just did an API call to get all links and I did confirm the link name is what it should be and there is no reason it should be returning an empty array.

Linked Fields for fs_payments

fs_billing_fs_payments_1
[name] -> 'fs_billing_fs_payments_1'
[type] -> 'link'
[relationship] -> 'fs_billing_fs_payments_1'
[module] -> 'fs_billing'
[bean_name] -> 'fs_billing'

Does anyone have a better example than this(shown below as well) as it is not very helpful in my opinion as true relationships/links in the CRM have names such as 'fs_billing_fs_payments_1' and seem to not work as the example shows.

$get_entries_parameters = array(
 //session id
 'session' => $session_id,
 //The name of the module from which to retrieve records
 'module_name' => 'Accounts',
 //An array of record IDs
 'ids' => array(
     '14b0c0ca-3ea2-0ee8-f3be-50aa57c11ee7',
 ),
 //The list of fields to be returned in the results
 'select_fields' => array(
    'name',
    'billing_address_state',
    'billing_address_country'
 ),
 //A list of link names and the fields to be returned for each link name
 'link_name_to_fields_array' => array(
      array(
           'name' => 'email_addresses',
           'value' => array(
                'email_address',
                'opt_out',
                'primary_address'
           ),
      ),
 ),
//Flag the record as a recently viewed item
'track_view' => true,
);
  • 写回答

2条回答 默认 最新

  • dqvrlgi3247 2015-01-08 16:42
    关注

    I was able to use the set_entry and bean relationship built into suiteCRM to pull the qb_studentid and accoutingclass and set them as hidden fields using a separate function so that they would show in the array when pulled using get entry in the actual api call to get the large array. This file is called using a logic hook to ensure that all qb_student IDs are pulled after a payment is synced. If you require a bit more detail on this please feel free to let me know. I struggled with this issue for some time and still have no answer from anyone not here nor in the sugarcrm or suitecrm community forums. This is more of a workaround if anything.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀