In my users collection, I have a summary view like this one:
Under Card, we can see the Smart field reference of the cards collection (hasOne association from users to cards collection). This smart field is built in part from the card’s status.
The “Get card status update” action is requesting a remote status in order to update the status field of the user’s card.
How to refresh the current user details section in the called action.
The end of the route called is currently containing:
Hello @Louis-Marie !
Please tell me if I understand your problem: You have a smart-field composed from data from both your database and a remote API call, and when you click on your smart action you want the field to be refreshed ?
Could you try replacing the 'cards' relationship in the solution Nicolas gave you by 'card' .
I tried, but nothing changed.
Is cards a basic collection or a smart collection?
It is a basic one (a native SQL table)
You said that that card was a smart field, could you share with me the definition of this smart action?
Please find below the main information regarding users, cards and things related to that issue:
db.users.hasOne(db.cards);
db.cards.belongsTo(db.users, { as: 'user', foreignKey: 'user_id' });
Liana.collection('cards', {
fields: [
// ... some other smart fields ...
{
field: 'CHID_and_status', // used as Reference
type: 'String',
get: (card) => {
if (card.remote_id && card.status === 'Deposit Only') {
return `${card.remote_id} / 🔥 Locked`;
} else if (card.remote_id && card.status) {
return `${card.remote_id} / ${card.status}`;
} else {
return null;
}
},
},
],
}
Liana.collection('users', {
actions: [
// ... many other actions ...
{ name: 'Get card status update',
type: 'bulk',
endpoint: 'forest/actions/users/get_card_status_update',
},
],
}
Basically, the smart action itself requests the remote status card, and updates the local status of the native cards table. The update is made without any problem. When I reopen the users record, the new status is correctly displayed.
I’ve eventually been able to understand and reproduce your issue.
Reference fields are designed to change the displayed content of a link to another resource. Unfortunately when performing a refresh after a smart action, only the updated id is tracked to update the link correctly (if you had change the related card itself and not its status, the link would have been updated correctly. But not the link content unless it’s the id itself)
As this behavior is not something previously handled by ForestAdmin and then broken I cannot make a bug report out of it. But I’ll flag it as a feature request from you and hand it over to our product team.
I understand your point of view, linked to technical constraints.
However, for a user’s point of view, he has a screen that shows a value (the smart field reference), and the updated value is not reflected after execution of the action. IT IS considered as a bug by the final user.
In this context, it cannot be just considered as a new feature request.
From my point of view, I would consider this as a misconception issue.
But, of course, things has to be improved little by little.
I would just kindly ask you to consider this as an issue not an improvement request.