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 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services