UI actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2025 04:00 AM
i have created the button through ui action on the incident table and named as export csv. here when i click on that button i want to download the incident list in CSV formate. how can i aachieve this.
function exportCSV() {
if (!confirm("Do you want to export the current incident list to CSV?")) {
return;
}
var gr = GlideList2.get('incident');
if (!gr) {
alert('Incident list not found.');
return;
}
var encodedQuery = gr.getQuery();
var view = gr.getView();
var orderBy = gr.getOrderBy();
var exportURL = '/incident.do?CSV' +
'&sysparm_query=' + encodeURIComponent(encodedQuery) +
'&sysparm_view=' + encodeURIComponent(view) +
'&sysparm_order=' + encodeURIComponent(orderBy);
window.location.href = exportURL;
}
i wrote this script in ui action script and where the onClick is: exportCSV();
does this script make any sense to achieve my requirement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2025 04:07 AM
Hi,
Why would you build a custom UI action for this?
There is already a built-in action to export any list to CSV.
See attached image.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2025 04:09 AM
@OlaN,
but the end user does not know the functionality right. i make easy him to export the data

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2025 04:11 AM
Then it would be even easier to create a report and share with that user.
Reports also has very easy and intuitive ways to export the data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2025 04:11 AM
do you have any script with screenshot of the above requiement
i'm missing some where logic..
both are the images of my ui action of above requirement