Reference Error : GwtPollDialog is not defined when exporting to Excel from UI Action

Ernie C
Mega Contributor

I cannot figure out why constructors new GwtPollDialog and new GwtExportScheduleDialog are both throwing these exception:

:"could not execute ui action '': ReferenceError: GwtPollDialog is not defined

could not execute ui action '': ReferenceError: GwtExportScheduleDialog is not defined. 

 

This code works perfectly in developer instances but not in any of the onsite instances.  All instances are on same patch level of Madrid. I have checked all of the parameters passed and they all return the same values in both cases.

function exporttoExcel() {

       var sysparm_rows = g_list.grandTotalRows;

         var num_rows = parseInt(sysparm_rows);
            var selSysIds = g_list.getChecked(); // This will return the sys_id of the selected records

    var sysIdList = selSysIds.split(',');

          var sysparm_query = "";

         for(var i=0;   i<sysIdList.length; i++) {

              if(sysparm_query   != "") {

  sysparm_query =   sysparm_query +"^OR" +"sys_id=" +sysIdList[i]; // Passing sys_ids to sysparm_query

                                                              }   else {
  sysparm_query =   "sys_id=" +sysIdList[i];

                                                              }

                                                           

                              }                 

      var tableName = 'incident'; // Table Name for which the records needs to be exported

           var sysparm_view = g_list.view;

// If the records are less then export threshold   GwtPollDialog will export the records in .xls format


                     if (num_rows < g_export_warn_threshold) {

var dialog = new GwtPollDialog(tableName, sysparm_query, sysparm_rows, sysparm_view, 'unload_excel_xls');

                         dialog.execute();

                         return;

                              }

// If the records are more then   export threshold GwtExportScheduleDialog will export the records in .xlsx format


var dialog = new GwtExportScheduleDialog(tableName, sysparm_query, sysparm_rows, sysparm_view, 'unload_excel_xls');

                              dialog.execute();

}

1 ACCEPTED SOLUTION

Ernie C
Mega Contributor
I have found the issue. Those constructors do not work with listv3. Once I reverted back to listv2 I was able to run this code with no issue. I will put in a ticket to make them aware of this issue

View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Have you checked installed plugins to make sure you arent missing one?

Have you checked the dependency related list to make sure a linkage isnt missing ?

Ernie C
Mega Contributor

thank you so much for your response. I will compare both suggestions when I return to work tomorrow. Thanks again.

Ernie C
Mega Contributor
I have found the issue. Those constructors do not work with listv3. Once I reverted back to listv2 I was able to run this code with no issue. I will put in a ticket to make them aware of this issue

Pooja58
Kilo Sage

Hello @Erni ,

Can we add the custom file name also to function GwtExportScheduleDialog?

As of now when we download the file, it saves with table name. file extension. So our requirement is to customize this file name instead of table name.

 

Best Regards,

Pooja