Dropdown based on other selected dropdown value

Hi everyone,

I am new to both NodeJS and ForestAdmin and all that includes, I have done other programming before like, PHP Javascript and jquery so I am not new to programming.

I have one collection of Customer and another one which is called CustomerContacts, both those are linked together so that when entering a customer I can see all the CustomerContacts which belongs to this Customer.

I also have a collection called Cases, and I want to be able to select CustomerContacts based on which Customer i have selected in the drowndown, ergo, I want to only get the CustomerContacts which belongs to the Customer I selected in the Customer dropdown.

I have searched for several days but are not able to find anythings that fits my needs.

The Case collection has relations to Customer and CustomerContacts so that is all done.

Case collection

const schema = mongoose.Schema({
    'customers': { type: mongoose.Schema.Types.ObjectId, ref: 'customers' },
    'customerContacts': { type: mongoose.Schema.Types.ObjectId, ref: 'customerContacts' },
  timestamps: true,

module.exports = mongoose.model('case', schema, 'case');

Also, in the Case view I want to show a field from the Customer collection called Instructions, but cant figure out how to do this.

Customer collection

const schema = mongoose.Schema({
  'name': String,
  'instructions': String,
  'createdAt': Date,
  'customerContacts': [{ type: mongoose.Schema.Types.ObjectId, ref: 'customerContacts' }],
}, {
  timestamps: true,

module.exports = mongoose.model('customers', schema, 'customers');

Can anyone please help me or atleast point me in the right direction?

Thanks in advance!

Hi @Svenjoelsson :wave: !

I’ll try to implement a smart action with hooks to see if that could fit your needs :slightly_smiling_face:


Yea, hooks is what i am looking for, but in the example its just on a smart action.
How can I implement this on the standard “Add” page while adding a new record?

Hello @Svenjoelsson,

If you want to achieve that, you’ll have to implement a smart action to add new Cases. The standard add action does not allow such customization.

As explained in the documentation linked by @vince, smart actions can specify forms and you’ll be able to specify the behavior you want to implement.