# Workspace Fields not updated after Smart Action if not on List

**URL:** <https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803>\
**Category:** Help me!\
**Tags:** smart-action, workspace\
**Created:** [November 1, 2023, 2:51pm UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803 "2023-11-01T14:51:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoad\_Snapir](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/yoad_snapir/32/101_2.png) [@Yoad\_Snapir](https://community.forestadmin.com/u/Yoad_Snapir)\
**Post date:** [November 1, 2023, 2:51pm UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/1 "2023-11-01T14:51:36Z")

</div>

## Feature(s) impacted

Workspace fields + Smart Actions

## Observed behavior

After a Smart Action in a Workspace is complete - The list (which is the source of that Smart Action) is updated with the requested fields = the ones show on the List.  
Any field, of that collection which are placed in the Workspaces (outside of the list component) will not update at this points unless they are on the List component.

**Note:** If a smart field is requested on the List component - All fields are projected and so some Fields will update and appear to “normally refresh” but this is an artifact of the “remove projection” scenario of Smart Fields (returned for all flattened fields which are not smart fields)

## Expected behavior

Workspace fields should update after Smart Actions are completed - or at least allow to specify those fields in the “refresh” response property of the Smart Action (only works for relationships today).

## Env

- Project name: WescoverContentAdmin
- Environment name: Private Development

```javascript
"meta": {
    "liana": "forest-express-mongoose",
    "liana_version": "8.7.6",
    "stack": {
      "database_type": "multiple",
      "engine": "nodejs",
      "engine_version": "16.18.0",
      "orm_version": "5.9.29"
    }
  }

```

---

<div class="post-metadata">

**Author:** ![anon7311026](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@anon7311026](https://community.forestadmin.com/u/anon7311026)\
**Post date:** [November 2, 2023, 7:41pm UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/2 "2023-11-02T19:41:26Z")

</div>

I have tried the same setup with forest-express-mongoose : “9.3.11” and it seems to be working on my side.

I tested running the smart action in a collection, and the update is reflected to 2 other component:

- a label containing the value
- the same collection in a different component

Could you please upgrade to the latest forest-express-mongoose version and test again.  
If you still see the issue, can you please provide some more info about your workspace, settings, and if you see any frontend or agent errors.

Thanks,

Regards  
@anon7311026

---

<div class="post-metadata">

**Author:** ![Yoad\_Snapir](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/yoad_snapir/32/101_2.png) [@Yoad\_Snapir](https://community.forestadmin.com/u/Yoad_Snapir)\
**Post date:** [November 3, 2023, 9:04am UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/3 "2023-11-03T09:04:17Z")

</div>

Hi @anon7311026 To make sure this is a Workspace thing and not related to the Liana version - I implemented a minimal repro on top of the new “agent” library (I hope this is good enough in this case, I cannot see why 9 vs 8 will fix this, but new agent vs 8 won’t).  
From what I researched this is a design flaw in the Workspace feature and unrelated to server side API implementation - but I could be wrong of course.

## Setup

The model

```javascript
const Mongoose = require("mongoose");

const schema = new Mongoose.Schema({
  name: String,
  size: Number,
});

module.exports = {
  collectionName: "teams",
  modelName: "Team",
  schema,
};

```

Setup of the agent:

```javascript
agent.addDataSource(
  createMongooseDataSource(connection, { flattenMode: "auto" })
);
agent.customizeCollection("Team", (collection) =>
  collection
    .addAction("increase size", {
      scope: "Single",
      execute: async (context) => {
        const { size } = await context.getRecord(["size"]);
        await context.collection.update(context.filter, {
          size: (size || 0) + 1,
        });
      },
    })
);

```

Setup of the workspace:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/2/2383f50a16a47be05d4b52e592b93bc76190562e.png)  
**Note** that the workspace list only shows “name” and that the field below shows the “size”.

## Repro Steps

- Load the workspace
- Select the first record on the list - shows the correct size on the field below
- Activate the action “increase size” from the “actions” dropdown
- The “size” field shows the old value still - in the DB the new size already exists
- Select another team - then go back to the modified team.
- The size fields reflect the new value now.

![Untitled ‑ Made with RecordCast](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/3/3a00fa1b572a30a6abd349a6875adcab51c1dcbd.gif)

---

<div class="post-metadata">

**Author:** ![nbouliol](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nbouliol/32/5777_2.png) [@nbouliol](https://community.forestadmin.com/u/nbouliol)\
**Post date:** [November 3, 2023, 1:59pm UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/4 "2023-11-03T13:59:55Z")

</div>

Hello @Yoad_Snapir

Thank you for this hightly reproducible setup !

Do you see an error in the browser console ?

---

<div class="post-metadata">

**Author:** ![Yoad\_Snapir](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/yoad_snapir/32/101_2.png) [@Yoad\_Snapir](https://community.forestadmin.com/u/Yoad_Snapir)\
**Post date:** [November 5, 2023, 8:58am UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/5 "2023-11-05T08:58:25Z")

</div>

I cannot spot any error relevant to this, maybe I am missing something (You refer to console errors or error HTTP responses?)

---

<div class="post-metadata">

**Author:** ![nbouliol](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nbouliol/32/5777_2.png) [@nbouliol](https://community.forestadmin.com/u/nbouliol)\
**Post date:** [November 6, 2023, 10:07am UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/6 "2023-11-06T10:07:18Z")

</div>

Hello

If you also have http errors, you can send both, but I mostly want to check the console errors

Thank you

---

<div class="post-metadata">

**Author:** ![Yoad\_Snapir](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/yoad_snapir/32/101_2.png) [@Yoad\_Snapir](https://community.forestadmin.com/u/Yoad_Snapir)\
**Post date:** [November 6, 2023, 10:25am UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/7 "2023-11-06T10:25:12Z")

</div>

Understood @nbouliol - No Problem.  
While reproducing the above - at no stage did I have any console errors.  
All HTTP requests (To the agent backend or Forest Api endpoints) completed with 200/204 - so no errors there as well.  
Hopefully this moves us closer to a resolution.

---

<div class="post-metadata">

**Author:** ![anon7311026](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@anon7311026](https://community.forestadmin.com/u/anon7311026)\
**Post date:** [November 6, 2023, 10:52am UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/8 "2023-11-06T10:52:39Z")

</div>

Hello @Yoad_Snapir,

Thanks for the added details, we managed to reproduce the issue.  
We have opened an ticket on our side and started working on a fix.  
We will keep this thread updated !

Have a nice day,

@anon7311026

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [November 10, 2023, 3:44pm UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/9 "2023-11-10T15:44:49Z")

</div>

Hey @Yoad_Snapir,

A fix has been released, everything should work now 🙂

---

<div class="post-metadata">

**Author:** ![Yoad\_Snapir](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/yoad_snapir/32/101_2.png) [@Yoad\_Snapir](https://community.forestadmin.com/u/Yoad_Snapir)\
**Post date:** [November 12, 2023, 9:59pm UTC](https://community.forestadmin.com/t/workspace-fields-not-updated-after-smart-action-if-not-on-list/6803/10 "2023-11-12T21:59:16Z")

</div>

Seems like indeed it’s solved (Entire modified record is reloaded!)  
Thanks for the quick response!
