- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2018 07:55 AM
I am looking for a way to add a button to my custom widget to export all of the data on said table to excel.
For example, right now my custom widget goes to table "X" and from there it query all of the name, address, etc. and display that on my widget as a table. I want to provide the user with a button to export all of that to excel (similar to how backend user can do it in almost all table).
I found this link which shows how to create a custom button, but what do I put in the server script?
Thank you for the help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2018 02:44 PM
So I found a way to make it work.
On the client side script of a widget all you need is the following:
window.location.href = "/" + {table name} + .do?EXCEL&sysparm_query=" + {your encoded query} +
"&sysparm_fields=" + {field name of the columns from the table};
I hope this will help anyone else who is trying to do the same as I am.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2018 10:36 AM
Hi,
I am doing the same thing on Platform UI and this link has really helped me achieve what I wanted-
https://jsfiddle.net/shaswatatripathy/fo4ugmLp/1/
Hope this helps!
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2018 01:20 PM
Thank you for your input, however, that is more for the UI policy (e.g. for backend use, not for service portal side).
I looked around in the context menu and I found the code to export to Excel, however when I copied that to the client script of my widget I get the following errors.
If g_list is not available on the portal side then what do I use instead?
Thank you for the help, thus far.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2018 02:44 PM
So I found a way to make it work.
On the client side script of a widget all you need is the following:
window.location.href = "/" + {table name} + .do?EXCEL&sysparm_query=" + {your encoded query} +
"&sysparm_fields=" + {field name of the columns from the table};
I hope this will help anyone else who is trying to do the same as I am.
Thank you.