How to display Show More records in custom Subpanel

Hi All,

I have one custom subpanel in contacts module. All the record values for that subpanel are coming from other services using REST API's and also we are not saving those records in DB as well. I have overridden the filterRelated function in clients/base/api/RelateApi.php for my custom subpanel. So now i able to populate all those records in custom subpanel. But Its displaying all the records coming from REST API. For eg. 40 records are coming from rest api response. all those 40 records are displaying in subpanel at a time.Sugar Limit for subpanel is not working for my case. But Sugar will display 5 records by default for subpanels. So I want to add "show more records" link for my custom subpanel.

Any idea on how i can solve it??

Thanks

Sundar

  • Hi , if you're implementing the subpanel using custom REST APIs, then we'll have to handle the pagination ourselves. Sugar will only paginate records which originates from the DB.

    Pagination is implemented using request parameters "max_num" and "offset". For example, the subpanel request will be in the format:

    http://localhost/rest/v11_5/Accounts/ff5238a6-54e2-487e-9cef-df9fe1112887/link/contacts?max_num=10&fields=...

    So, for the subpanel that you've created, sugar will automatically send the "max_num" parameter, which you can get from $args['max_num']. Forward the max_num values to your  "External" services so it only returns that many records. If it's not possible to filter those through external APIs, filter them manually in your code.