I want to create a UI action that allows me to export a list in bulk using multiple layouts and filt

bonsai
Mega Sage

I am using the following code to bulk export data from an incident table, specifying multiple conditions.

 

// You need to disable the browser popup blocker
// (otherwise, you won’t be able to download all data)
function onClick() {

    // For each layout you want to export,
    // set the "filter condition (query)" and "fields to display (fields)"
    // Use "Copy query" after applying filters on the list screen to get the query.
    // Fields are specified as a comma-separated list.
    // You can increase the number of fields as needed.
    //
    // Example: Configuration to export 3 types of data from the Incident table
    var table_name = "incident";
    var configs = [{
            query: "priority=1^active=true",
            fields: "number,short_description,priority,state"
        },
        {
            query: "assigned_toISEMPTY^active=true",
            fields: "number,assigned_to,opened_at,category"
        },
        {
            query: "",
            fields: "number"
        }
    ];

    // Export each configured item in Excel format
    configs.forEach(function(cfg) {

        var url = "/" + table_name + ".do?EXCEL" +
            "&sysparm_query=" + encodeURIComponent(cfg.query) +
            "&sysparm_fields=" + cfg.fields;

        top.window.open(url);
    });
}

 

This code only handles records that depend on the export property settings.
 
Is there a way to export all records regardless of property values?

 

2 REPLIES 2

Rafael Batistot
Mega Patron

Hi @bonsai 

 

No.

 

A client-side UI Action using table.do?EXCEL cannot export all records because it always respects ServiceNow export limit properties.

 

To export all records regardless of properties, you must use a server-side solution, for example a server-side UI Action or Script Include using GlideExport or GlideExcelGenerator in ServiceNow.

 

Client-side workarounds like sysparm_limit=0 are unreliable and do not bypass hard limits.

 

Ankur Bawiskar
Tera Patron

@bonsai 

whatever export custom solution you create it will respect the OOTB system properties for export of CSV or Excel

55.png

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏