Custom Workspace UI Action – Export Only Visible Form Fields to Excel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
I have a requirement in a Custom Workspace where I created a UI Action button (Export to Excel) on a form.
Requirement:
When the user clicks the Export Excel UI Action from Workspace:
The Excel file should contain only the fields that are currently displayed on the Workspace form
Only the visible form fields
The exported Excel should include the field labels and their corresponding record data
Fields that are hidden / not present on the form should NOT be exported
Context:
Workspace: Custom Workspace
UI Action: Workspace-compatibleForm is built using UI Builder components
Export should be dynamic
Questions:
Is there any OOTB way to get the list of visible form fields in Workspace during a UI Action execution?
If not supported OOTB, what is the recommended best-practice approach to achieve this?
Any suggestions, examples, or documentation references would be very helpful.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @dattanarend ,
In Workspace, actions like Export to Excel are not handled purely through classic UI Actions. They are typically configured and controlled through UI Builder, where the form and its actions are rendered.
Currently, there is no out-of-the-box way to retrieve the list of only visible form fields from a Workspace form during UI Action execution. Server-side scripts do not have direct awareness of the UI Builder form’s visibility state.
The recommended best-practice approach is to:
Identify or track the visible fields on the client side (UI Builder / form component)
Pass the list of visible field names to the server (via an action, data broker, or Script Include)
Generate the Excel file dynamically on the server using only those fields, including field labels and record data
This approach aligns with Workspace design patterns, avoids hardcoding fields, and supports dynamic layouts. In more advanced cases, the button action may be wired to client logic, actions or data brokers, and Script Includes, all managed through UI Builder.
If you find this response helpful, please mark it as Helpful and accept it as the solution if it addresses your question—it would encourage me to contribute more to the ServiceNow Community.
Thanks & regards,
Sachin Narayanasamy
Thanks & Regards,
Sachin Narayanasamy
