Edit widget dropdown on dynamic collection should send the whole row instead of just the field

Expected behavior

On my order collection when I edit the sales smart field with the dropdown widget which gets on the user collection showing their name (I filter the collection by status to only get the sales), the set() function inside my smart field should get the whole user and not only its name.

Actual behavior

When I edit my smart field picking a user name in the list, it sends the name to the set() function of that smart field. IMO it should send the whole user.
In my case I use a smart field to display the sales person picture in my rows instead of its name which is too long and less visual.
To get that picture I use the order.sales object.
If I want to change the sales person on that row, I pick its name on the picture smart field but in the set() function I need its id to associate it to my row.


"meta": {
    "liana": "forest-express-sequelize",
    "liana_version": "8.0.9",
    "stack": {
      "database_type": "mysql",
      "engine": "nodejs",
      "engine_version": "14.17.0",
      "orm_version": "5.21.7"

Hey @mathieuh :wave:

Wouldn’t smart relationships be a more suitable solution for your issue instead of a classic smart field?
You would be able to have a direct link between your two collections & you should normally have all the informations you need.

Let me know if that helps.

Hi @jeffladiray,

Well I got a real relationship on this field but I couldn’t achieve to print the photo of the sales instead of his name. Would smart relationship let me do that?
The display widget is limited to text or link in the real relationship case.

What I try to achieve:


Sorry, but I think I did not fully get your use case here :confused:

Smart field is a good idea to display a photo. If you want to display a photo in the table view and allow edition via a dropdown or typeahead widget, I would suggest to set the photo smart field as read only, and hide the relation in the table view, and do the inverse in the edit/create view?

(But maybe I got this wrong, let me know)

Otherwise, I don’t think there is anything today to achieve your initial Expected behavior with the current state of smart field (Sending a different information than the one selected in your dropdown), but I’m pretty sure you can achieve something similar with a combination of read-only/smart-fields/smart-relationship. If you have a full detail of what you want to achieve, it might help me to lead you with the best solution.

Thanks in advance :pray:

Hehe no worries, I’ll try to explain better.

I got orders which are made by users. Sometimes there is a sales person linked to an order. When so, I want to display the sales person with his photo only to keep the row short and more visual.
From here, everything is fine.

At the moment, they can assign themselves going on the sales relationship and picking their name.

What I’d like to achieve is let a sales assign themselves right clicking on the photo smart field and picking their name (I was almost there but it doesn’t work because the widget only sends the name of the sales and not the whole object and I can’t retrieve the sales only by their name).

I’m not sure I understand your workaround.

For now on, the sales will assign themselves with the relational field.


Thanks for the complete explanation.

We currently do not handle this use case, so I’m pushing this as a feature request in our product board.

The initial workaround I proposed will not work the use case you have here sadly.
As a side note, does your sales persons have an account on your forestadmin backoffice? If that’s the case, I think an “Assign to myself” single or bulk smart action could also do the trick for your use case, and it would also avoid the need for them to enter their name each time. You can even add an “Assign to …” smart action, and display a smart action form using hook to prefill their name based on their forestadmin account (Thus, allow to select from a dropdown any sales). This would also allow you to let the sales picture smart field as read-only.

This is not exactly what you envisionned, but I think this could be a nice workaround for your use case.

Let me know :pray:

Ok no worries.

Yes they all have an account but they sometimes assign other sales. I’ll find the workaround that suits my case best.


1 Like