How to create a button on service portal to export the data in excel

aditya174
Tera Guru

Hi,

I want to create an export to excel button that exports the data that is coming on the portal page from API, we are not storing that data in the servicenow table but we want to export it directly from the page view.

 

aditya174_0-1718292127360.png

How we can achieve this.

Regards,
Aditya

2 REPLIES 2

Yashsvi
Kilo Sage

Hi @aditya174,

Create a UI Action:

  • Navigate to System Definition > UI Actions.
  • Create a new UI Action for the table you want to export.
(function runAction(){
    var exportUtil = new ExportUtil();
    var data = exportUtil.exportData();
    gs.eventQueue('export_to_excel_event', current, data, gs.getUserID());
})();

Thank you, please make helpful if you accept the solution.

 

 

Hi,

 

I want to have that functionality on service portal widget, im not storing the table data on servicenow table, so i want to export from the page using the button rather than creating a ui action on table, can you help me with this.

 

Regards,

Aditya