Unable to dynamically filter choice list (show only current + cancelled) in Workspace

PasipuY
Mega Explorer

Description:

I am working in a Workspace and have a requirement on a choice field status.

Requirement:

  • The dropdown should always display only:

    • The current status value

    • The “closed” option

  • All other choices should be hidden from the user

What I tried:

  1. Client Scripts (onLoad & onChange)

    • Used g_form.clearOptions(), removeOption(), and addOption()

    • Initially works for a moment, but Workspace re-renders the field and all choices reappear

    • Also observed “previous value” appearing unexpectedly

  2. Different variations

    • Hardcoded removeOption() for each state

    • Dynamic filtering using loops

    • setTimeout() to delay execution

    • Using control.options[selectedIndex] instead of getDisplayValue()

  3. Server-side approaches

    • Business Rules (but they only restrict saving, not UI display)

Issue:

  • In Workspace, the choice list seems to be re-bound from the data source after client scripts execute

  • Any attempt to dynamically remove options is overridden

  • This results in:

    • Previously removed options reappearing

    • Inconsistent dropdown behavior

Question:

  • Is there a supported way to dynamically filter choice options in Workspace so that only the current value and a specific option (e.g., “closed”) are shown?

Any guidance or best practices would be appreciated.

0 REPLIES 0