Cannot get all IDs for custom export smart action

Expected behavior

I have 2023 records. When I click on “SELECT ALL RECORDS” then click on Actions → My smart export, I should get 2023 records ID in req.body.data.attributes.ids.

Actual behavior

There are only 15 records ID of the first page in req.body.data.attributes.ids array.

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version: 4.17.1
  • forest-express-mongoose: 7.0.0
  • json2csv: “^5.0.6”
  • Project Name: Orthotekos

Hi @NathanLe :wave: welcome to our community.
If you use the select all feature, you need to use getIdsFromRequest helper from RecordsGetter like the code below:

const ( RecordGetter, permissionMiddlewareCreator } = require('forest-express-mongoose');
const { companies } = require('../models');

router.get('/companies.csv', permissionMiddlewareCreator.export(), (request, response, next) => {
  new RecordsGetter(companies).getIdsFromRequest(request)
    .then((ids) => {
      // Do what you want.
    });
});

Let me know if that help.

1 Like

I had a full id list of selected records. Thanks Arnaud Moncel!

2 Likes