How to implement an Export button using UI Action for list views

kuuum_aaaya
Tera Contributor

I want to implement an Export button using UI Action that appears in the top-right area of list views, similar to the context menu Export > Excel functionality, allowing users to download list data with a single click.
Could you please provide implementation guidance?
Requirements:
Display as a list button in the top-right area of list views
Provide the same functionality as the context menu "Export > Excel" option
Enable one-click list data download
Should work consistently across different tables
What I've tried:
I've created a UI Action but I'm having issues with the client script implementation to trigger the export functionality properly.
Any help with the proper configuration and client script would be greatly appreciated.
Thanks in advance!

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @kuuum_aaaya 

This is available out of the box, so why do you want to rebuild the same? Don’t create technical debt—it’s better to educate users to work with the way the system has been built.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

@Dr Atul G- LNG Thank you,
I completely agree with your point about avoiding technical debt and using OOTB functionality. However, this is a specific customer requirement that we need to accommodate.
That said, I'd like to explore both options and understand which would be simpler to implement while staying as close to OOTB as possible:
Option 1: Create a custom UI Action for the Export button (as originally requested)
Option 2: Keep the OOTB Export functionality (context menu) but hide other buttons/options for users without specific roles
For Option 2, if we use the OOTB Export (context menu), we would want to hide other context menu options or list buttons based on user roles to simplify the interface for end users.
Questions:
Which approach would be easier to implement and maintain while staying closer to OOTB functionality?
If we go with Option 2 (keeping OOTB Export), what's the best way to hide specific context menu items or buttons based on user roles?
Are there any OOTB role-based visibility controls for list context menus that we should leverage?
I'd appreciate your guidance on the most ServiceNow-native approach to meet this requirement while minimizing customization and technical debt.
Thank you for your insights!

Hi @kuuum_aaaya 

 

Option 1:
I would recommend this, as it is OOTB code you are using—just adding that outside the context menu.

Option 2:
No, this will increase technical debt and also require a heavy customization.

 

https://www.servicenow.com/community/servicenow-ai-platform-forum/disable-hide-export-context-menu-o...

 

https://www.servicenow.com/docs/bundle/zurich-platform-administration/page/administer/navigation-and...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Pradeep Thipani
Mega Sage

Hi @kuuum_aaaya ,

 

If you are looking any workspace view, you will already have export options available through OOB. Please find the attached snapshot.

 

PradeepThipani_0-1756333698992.png

 

If you wish to replicate this in the native UI, you may review the OOB button configurations and attempt to implement them in the Native UI. The configurations for the workspace button can be found in declarative actions.

 

PradeepThipani_1-1756333819629.png

 

Thanks,

Pradeep

 

 

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep