Referencing another Model in smart action

Expected behavior

When declaring a smart action like this

action '🎈 Invite a new user in this team', type: 'single', fields: [{
    field: 'Inviter email',
    description: 'Your Okarito name will show in the invite email',
    type: 'String',
    reference: 'Team.id',
    is_required: true
  },
  {
    field: 'New user email',
    type: 'String',
    is_required: true
  }]

I expect this field to accept typing and suggest Users emails

My User model setup in the UI (last checkbox is disabled)

Actual behavior

Field in the smart action is disabled.

Context

Please provide any relevant information about your setup.

Rails Liana, Liana 3.3. Project okarito.

Hi @remi_okarito and Welcome to the Forest Admin Community :champagne: !

To be able to search on record when editing, like in your case you need the Allow search to edit to be enabled.
But what I think there is an issue in you action too, you should not be referencing Team.id but User.id. The Team will already be passed by checking a record in the table view.

EDITED:
After reading your post again I see that the checkbox is disabled. This is an issue on the platform. You need to hide the collection on the left panel. Go to the settings and click on that checkbox (Allow search to edit) and save. Then you can show back the collection and it should work.

I hope that helps you :pray:

Hello @vince thank you for your quick feedback. Hiding and re-showing collection just worked

But… this is quite not very intuitive :smiley:

Yeah. It was fixed today. It should normally not happen in the future :smile:

Thanks so much. I was about to ask for help for enabling the “Allow search to edit” checkbox. Apparently it’s only editable if the model is hidden :see_no_evil:

1 Like