Hi all,
I’m trying to solve a state retention issue with an embedded module inside an overlay in Workshop.
Setup
I have:
-
a parent screen where the user makes a selection
-
a button that opens an overlay
-
inside the overlay:
-
a close button
-
an embedded module
-
The parent screen passes the user’s selection into the embedded module via interface variables.
Inside the embedded module, the screen contains:
-
an Object Set Filter
-
an Object Table
The Object Set Filter is backed by a function-backed Object Set.
Current behavior
The filter state is being retained (apparently via promoted variables, although I did not originally implement that part).
Example:
-
User selects A in parent screen
-
Opens overlay / embedded module
-
Embedded module loads filter options, and filter value 1 is selected
-
User closes overlay
-
User later selects B in parent screen
-
Opens overlay again
-
Embedded module now has filter options where only 2 is valid
-
But 1 is still retained/selected from the previous session
This causes the Object Table to show no rows, because the retained filter value is no longer valid for the new parent selection.
Requirement
I need the filter to behave like this:
-
If the current parent selection = previous parent selection, retain the filter
-
If the current parent selection ≠ previous parent selection, reset the filter
What I tried
I introduced:
-
currentSelection -
previousSelection
currentSelection is passed into the embedded module as usual.
For previousSelection, I configured it to:
-
not compute automatically
-
update on event (specifically when the overlay / embedded module is closed)
So conceptually:
-
when overlay closes → store current selection as previous
-
when overlay reopens → compare current vs previous
Roadblocks
I’m stuck because:
-
I cannot make the promoted variable conditional
- It seems like once filter retention is enabled, it persists regardless of whether parent context changed
-
I cannot reset the embedded module’s Object Set Filter from the parent module
- From the parent button / overlay open event, I don’t see a way to directly clear or control the embedded module’s filter state
Workaround I am considering
As a workaround, I introduced a button inside the embedded module that is only visible when:
currentSelection != previousSelection
The idea is:
-
if the parent selection changed, user sees the button
-
user clicks it to reset / refresh the filter state for the new context
This is not ideal UX, but it is the only path I can currently think of.
My main questions
Is there a supported way in Workshop / embedded modules to do any of the following?
-
Conditionally retain an Object Set Filter only when parent context is unchanged
-
Automatically trigger the event of resetting the filter when the condition is matched
-
Or otherwise invalidate retained filter state when interface variable inputs change
What I’m trying to achieve
I want users to keep their filter selections only when reopening the same context, but not when they switch to a different parent selection.
If anyone has implemented this pattern before, I’d appreciate guidance on the cleanest supported approach.
Thanks!