Loading related data with inital filter

Feature(s) impacted

I’ve created a smart collection which displayed as related data in another collection.
I’ve also implemented the filter and search logic for this collection.

My goal is to have several instance for the same related data applied with different filters

Observed behavior

I couldn’t find a way to define it in the UI

Expected behavior

Being able to drag n drop several instance of the related data item with predefined section.

Failure Logs

Context

  • Project name: Empathy
  • Team name: Engineering
  • Environment name: development
  • Agent type & version:
  • Recent changes made on your end if any: implementing smart collection, and its filter and search capabilities.

You seem to be using forest-express according to your project name.

Would something like this suite your need?

const express = require('express');
const { collection } = require('forest-express-sequelize');

const router = express.Router();
const filters = {
  email_starts_with_a: { field: 'email', operator: 'starts_with', value: 'a' },
  email_starts_with_b: { field: 'email', operator: 'starts_with', value: 'b' },
};

Object.entries(filters).forEach(([filterName, filterValue]) => {
  /// ////
  // Define smart collection
  /// ////

  collection(`customers_${filterName}`, {
    isSearchable: true,
    onlyForRelationships: true,
    fields: [
      { field: 'email', type: 'String' },
      { field: 'orders_count', type: 'Number' },
      { field: 'total_amount', type: 'Number' },
    ],
  });

  /// ////
  // Define smart collection routes
  /// ////

  // list route
  router.get(`/forest/customers_${filterName}`, (req, res) => {
    // Implement your custom list route that depends on `filterValue`
  });

  // get route
  router.get(`/forest/customers_${filterName}/:recordId`, (req, res) => {
    // Implement same route all the time, as the pk is provided in the URL
  });
});

module.exports = router;

Thanks for the quick reply,

I was referring to a UI based solution without defining separate routes and collections.

Is this something that can be done ?

Sadly, there is none as of today.