How to display a HTML link to a model in another database

Setup information

    "express": "~4.17.1",
    "forest-express-sequelize": "^9.2.6",
    "sequelize": "~5.15.1"


I have two models (contract and store) in separate databases.
contract has a storeId fields, which references This is not a foreign key since they are in different databases.

I want, on the contract summary, to be able to display a link to the store referenced by storeId.
I’m aware relationships between models in different databases are not possible, and I do not need a full fledged relationship, just a simple link.

I tried using a smart field with a Link widget, but the URL depends on the user’s team and as far as I know I can’t access that from a smart field.

Can somebody help me figure this out?

Thanks in advance!


Hello @antoineww and welcome to the community !

You can do exactly that with a Smart Relationship, here is the link to our documentation on how to create a smart relationship.

Best regards,

Hey @dogan.ay , thanks for you answer!

I managed to make it work, but for what it’s worth, I had already seen and tried it but could not figure out how to make it work, the examples did not cover a similar use case.

Here’s what I ended up with:

      field: 'store',
      type: 'String',
      reference: '',
      get: function (contract) {
        return { id: contract.storeId };
1 Like