How to download List view into excel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2024 06:38 AM
I need help to provide a button on top right corner to download list view as excel.I know i can go with export from list cloumn but i need a button. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2024 01:41 AM
Hi @skylarj
You can create this UI action
function generateExcel()
{
tblName = g_list.getTableName();
selSysIds = g_list.getChecked();
sysIdList = selSysIds.split(',');
var encodedQuery = 'sys_idIN'+sysIdList; //sys_idIN
g_navigation.open('/' + tblName + '_list.do?EXCEL&sysparm_query='+encodedQuery, '_blank');
}
For selected records to download, use sysparm_query. If you need to download all records, dont use sysparm_query
🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2024 07:56 AM
Hi @skylarj
### UI Action for Export to Excel
You can create a UI Action that instructs users on how to export the list to Excel using the platform’s built-in functionality. This approach ensures adherence to ServiceNow’s security and export mechanisms.
1. Navigate to System UI > UI Actions.
2. Click New to create a new UI action.
3. Fill in the fields on the form:
- Name: Give a descriptive name, such as “Export to Excel Guide”.
- Table: Choose the incident table.
- Action name: This is auto-populated based on the Name but can be adjusted as needed.
- Client: Select this option as the action will be executed on the client side.
- List: Check this to ensure the action appears in list views.
- Form: Optionally check this if you want it available in form views.
- Comments: You can provide a description or guidance here.
4. In the Script field, instead of trying to directly execute an export (which isn’t recommended or straightforward due to security reasons), you’d provide a script that either:
- Informs the user to use the built-in export functionality.
- Triggers a modal or an informational alert to guide them.
Example informational script (Client-side):
new GwtMessage().notify(‘Use the built-in “Export” option by right-clicking on the list header and selecting “Export > Excel”.’, ‘info’, 5000);
5. Conditions: Set conditions for when this UI Action should be available, if necessary.
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
Thanks & Regards
Deepak Sharma