Dynamic Smart Action Form Question

Hey Forest,

I’m trying to use dynamic smart action forms. So the intention in the form is to
1)pick a user
2)a new field appears listing every team(belongsTo relationship with user) that the user has.

I am able to get the reference field to teams with an onChange hook, but how do I narrow this down from every entry in teams to just this user’s teams? I’ve seen a similar topic in the documentation but I think what I need is a bit different since it’s a reference field. This would improve our workflow and smart action usability by a lot. I attached the code snippet below.


Thank you in advance!

Hey @Arda_Yurdakul,

For your case, I would suggest to manually fetch the value you want (Based on the user’s team) to display, remove the reference: 'teams.id' and manually set the values you want to display.

Something like

const teams = getTeamsOfUser();
fields.splice(2, 0, {
    field: 'User teams',
    description: 'The selected User\'s teams',
    type: 'Enum',
    enums: teams.map(t => t.name)

(This code is untested, but contains the general idea)

Let me know if that helps :slight_smile:

1 Like

Hey @jeffladiray

That did help thank you :metal:

1 Like