Smart action form displaying data from previous use of smart action

Smart action functionality

Our project requires the use of a smart action that connects multiple units in a property. The first step a user would do is select the parent unit, then select the child units.

Observed behavior

On local and dev, the functionality works as expected. The list of possible child units is rendered correctly and the agent can select which of the child units to connect to the parent one.

On prod and stg environments we sometimes observe the list of rendered child units belonging to other properties. we usually need to refresh multiple times to have the correct child units available for the agents to select from.

Expected behavior

  • when an agent selects a parent property, only the list of related units shall appear for an agent to select from.

To replicate

FYR: I added this video for you to see the issue
Step 1: Select a property
Step 2: Go to smart action, select the connection (Parent) unit
Step 3: Select the section (child) units
Step 4: Add association
Step 5: Repeat steps 1-3 for another property. The list of sectioned units belongs to the previous unit

sometimes even from the first try, the list of the sectioned units is incorrect.


Please provide in this mandatory section, the relevant information about your configuration:

  • Project name: Chalet+
  • Team name: all teams facing this issue
  • Environment name: stg and prod
  • Agent type & version: …
  • Recent changes made on your end if any: release of this feature

Hi @Yusra_Bagosher :wave:,

Could you please share you Smart Action configuration (on your backend) :pray: ?

Hi @vince

I have uploaded the file that that has the implementation of this smart action. (1.9 KB)

1 Like

I see a few issues in your hooks. First I would greatly recommend you not to store the units in a global variable as this could produce this kind of issue (it’s async so if your first call to load finish after you open the second time the smart action hooks you could end up with not the right records). So just use fields['Connection unit'].enums that you have loaded during the load hook.
Plus in the change hook you are no more displaying name but you pass record instead :thinking: ?!

This may be should fix your issue:

  hooks: {
    load: async ({ fields, record }) => {
      const result = await getUnits(;
      const unitsName = => item.originalNameEn);

      fields['Connection unit'].enums = unitsName;
      fields['Section units'].enums = unitsName;
      return fields;
    change: {
      'Connection unit': ({ fields, changedField }) => {
        const sectionUnitsEnum = [...fields['Connection unit'].enums];
        const connectionUnit = fields?.['Connection unit']?.value;

        const valueIndex = sectionUnitsEnum.indexOf(connectionUnit);
        if (valueIndex !== -1) {
          sectionUnitsEnum.splice(valueIndex, 1);
        fields['Section units'].enums = sectionUnitsEnum;
        fields['Section units'].value = null;

        return fields;

Let me know if it fixes your issue

1 Like

Hi Vince, Thank you for your help, will give it a try.
For the section units name i am displaying it from the records.

1 Like