Export Related List

neharao
Giga Contributor

Hi all,

I a trying to use this functionality provided by SNGuru i.e Exporting of Related List (https://www.servicenowguru.com/system-ui/enabling-related-list-exports-servicenow/ ). But when i try to achieve this i am getting error in the script part. Please find the error below.

find_real_file.png

Can someone please guide me on this.

Thanks,

Neha

1 ACCEPTED SOLUTION

if condition should be



if(g_list.getListName().indexOf('.REL:') > -1) {


g_menu.setHidden(g_item) ;


}


View solution in original post

9 REPLIES 9

Hi Harsh,



Thanks for the correction. The first part of the script worked fine. But now when i am trying to save the second part of the script its giving error


find_real_file.png



Could you please help on this.



Thanks,


Neha


neharao
Giga Contributor

I corrected the script now no Error. Please ignore my above comments


can you please provide the script for export to excel?


neharao
Giga Contributor

Hi Shristy,



You can find the full details in this link https://www.servicenowguru.com/system-ui/enabling-related-list-exports-servicenow/ .


Also please find the below script for CSV.


function doStuff() {


    var sysparm_table = "";


    var sysparm_sys_id = g_form.getValue('u_number');  


    var sysparm_query = "parent=" + sysparm_sys_id;



    //Define the related list table


    sysparm_table = 'my_related_table';


    runContextAction(sysparm_table, sysparm_query);


}



function runContextAction(sysparm_table, sysparm_query) {


  //Obtains the rows number of the current report


  var sysparm_rows1 =$$('.list_row_number_input span')[1].innerHTML;



  //Parses string value into an integer value


  var num_rows = parseInt(sysparm_rows1);



  //Get view name needed to export


  var sysparm_view =gel('sysparm_view').value;



  //Creates export file if rows is less than limit value


  if (num_rows < g_export_warn_threshold) {


        var dialog = new GwtPollDialog(sysparm_table, sysparm_query, sysparm_rows1, sysparm_view, "unload_excel");


        dialog.execute();


        return;


  }


  var dialog = new GwtExportScheduleDialog(gel("sysparm_table").value, sysparm_query, sysparm_rows1, sysparm_view, "unload_excel");


  dialog.execute();


  return;


}




Hope this is helpful.


Thanks,


Neha


Priya Shekar
Giga Guru

Hi All,

 

I would like to Export Data to Excel in multiple Tab format for each related lists. I already have a UI button in the record which has related lists, and i am able to export a single related list. How can we export multiple related lists in multiple tab?

 

Thanks,

Priya