How to remove Add Record\Relationship button from a table view

Feature(s) impacted

I have the following set up.
Three tables.
Accounts and Users and a many-to-many table between the two called AccountUser

Account has oneToMany AccountUsers
AccountUser has ManyToOne users and ManyToOne accounts

Observed behavior

On the AccountUser table view in Forest Admin it seems we can add accounts by the default + button with the text “add an existing account” and this cause us some issues, because we can’t really remove it.

I did found a solution to override this relationship route and instead of using “next()” i’m returning an error and this solves it in a way, however we would like to remove this button all together, and couldn’t found a way to do so

Expected behavior

We would want to be able to remove this button all together.

This is how we ended up disable this button in the routes class
  async (request, response) => {
      errors: [{ detail: "Cannot create user-account relationship manually" }],


  • Project name: Empathy
  • Team name: Engineering (any team)
  • Environment name: All (production, dev, etc )
  • Agent type & version: forest-express
  • Recent changes made on your end if any: …

Hello @Avishai_Lippner,

Thanks for your feedback.

Can you describe how is declared the relationship between these tables with sequelize inside your code?


User model association:

User.belongsToMany(models.account, {
      through: models.accountUser,
      as: "accounts",

Account model association:

Account.belongsTo(models.user, {
      foreignKey: {
        name: "createdByKey",
        field: "createdBy",
      as: "Created By",
Account.belongsToMany(models.user, {
      through: models.accountUser,
      as: "users",

AccountUser model association:

  AccountUser.associate = (models) => {
    AccountUser.belongsTo(models.user, {
      foreignKey: {
        name: 'userIdKey',
        field: 'userId',
      as: 'user',
    AccountUser.belongsTo(models.account, {
      foreignKey: {
        name: 'accountIdKey',
        field: 'accountId',
      as: 'account',

  return AccountUser;


I checked on our side, and today it’s not possible to hide this button here in the UI. I’m adding this suggestion to our feature requests.

Hello again @Avishai_Lippner,

Actually I have a suggestion: you can mark a relationship as read only. It’ll hide the + button in the UI when accessing relations of a record.

Here is how to proceed:

  • Switch to the layout editor
  • click on the :gear: next to the name of the Users collection
  • click on the Fields tab
  • select the relationship named accounts
  • switch it to read-only mode and save your changes

Looks like it did the trick,
Thank you @GuillaumeGautreau

1 Like