Reference in smart field

It’ is possible to use any reference in smart field ?

Observed behavior

{
      field: 'Rattache',
      type: 'String',
      reference: 'places.id',
      reference: 'maintenanceContracts.id',
      get: function (serviceTask) {
        if (serviceTask.notion === 'PLACE') {
          return models.places.findOne({
            where: { id: serviceTask.notionId },
          });
        }
        else  if (serviceTask.notion === 'CONTRACT') {
          return models.maintenanceContracts.findOne({ where: { id: serviceTask.notionId } });
      }
      }
      
    }

Context

Project name: .Sergic
Team name: gestion
Environment name: Développement
Agent (forest package) name & version: 9
Database type: Postgres
Recent changes made on your end if any: upgrade to v9

Hi @Soufiane ,

What type of agent do you use ?
forest-express-sequelize ?

Regards,

Shohan

Thank you for your feedback,
I use forest-express-sequelize-9.3.3 and node.js agent

The reference is used for smart relationships, and not smart field. Doc here

Can you clarify what is your goal with multiple references ?

Best regards,

Shohan

I want to create an smart field wich display a link to the summary view (PLACE) or a link to the summary view (CONTRACT)

{
      field: 'Rattache',
      type: 'String',
      reference: 'places.id',
      reference: 'maintenanceContracts.id',
      get: function (serviceTask) {
        if (serviceTask.notion === 'PLACE') {
          return models.places.findOne({
            where: { id: serviceTask.notionId },
          });
        }
        else  if (serviceTask.notion === 'CONTRACT') {
          return models.maintenanceContracts.findOne({ where: { id: serviceTask.notionId } });
      }
      }
      
    }

Unfortunately, with forest-express-sequelize it will not be possible to have polymorphism of belongsTo.
We are releasing soon the possibility to do it with a Rails project though.

Best regards,

Shohan