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
Note:
sometimes even from the first try, the list of the sectioned units is incorrect.
Context
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
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 ?!