Need to add an export button on a dashboard where it exports all the records on a table to excel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 02:29 AM
I have a requirement to add an "Export button" on a dashbord. when we click on the button it should export all the records on the table.Can anyone help me how can we add a button on dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 02:55 AM
Try below code in UI action
function downloadExcel(){
var checked = g_list.getChecked(); // get's the sys_id of the checked records
var query = "sys_idIN" + checked.toString();
var rows = checked.split(",").length; // rows to be sent to the export function
// this code you can move to script include and go GlideAjax as well
var gr = new GlideRecord('sn_customerservice_case');
gr.addQuery('sys_id', 'IN', rows);
gr.query();
while(gr.next()){
gr.u_exported = true;
gr.update();
}
var view = "default"; // set this to default for columns present in default view for list layout
// set this to empty if you want all the columns present in the list layout including the customized ones.
var dialog = new GwtPollDialog('sn_customerservice_case', query, rows, view, 'unload_excel_xlsx');
dialog.execute();
}
Please check and let me know if it helpful or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 03:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2022 09:39 PM
You can achieve this like below. You can create UI action in "pa_dashboard" table and it look like similar
Once we click this link it export all dashboard related record in excel sheet. This only way it will possible in dashboard button will not appear.
Please check and Mark Helpful or Correct if it helps you.