I want to use the filter conditions set by the user in a list as query conditions within the script.

bonsai
Mega Sage

I'm considering a process to export all records stored in a table in bulk, based on filter conditions set by the user in a list.

I want to specify the same query conditions as the manually set filter conditions during the export, but it doesn't work correctly if the filter conditions contain "javascript:~".

 

bonsai_0-1779374479624.png

The copied query: "caller_id=javascript:gs.getUserID()^active=true^universal_requestISEMPTY"

 

 

The script retrieves the data as shown below, but executing addEncodedQuery with a condition including "javascript:~" did not work.

*The query condition is set within test_ajax.

  var query = "";

  var list = GlideList2.get('incident');
  query = list.getQuery();
  alert(query);

    var ga = new GlideAjax('test_ajax');
    ga.addParam('sysparm_name', 'start');
    ga.addParam('sysparm_query', query);

    ga.getXMLAnswer(function(a) {
        alert(a);
    });

Does anyone know a better way?

Although it's set to export in bulk, in reality, it's exporting in batches of 1000 items.

A waiting time is also included to avoid high load.

0 REPLIES 0