B.5 Running an Existing Saved Query

You can use the JavaScript API to execute a saved query. Before you execute a saved query, you need to perform the following JavaScript statement to retrieve the saved queries (as described in the previous section):

JUICE.IDM.Entities.Search.getNames();

You need to call getNames() first, even if you know the name of the saved search you want to run.

After calling the getNames() function, you need to perform these steps to execute the saved search:

  1. Call the getUUID() method to access the UUID associated with the search name.

  2. Call the load() method on the JUICE.IDM.Entities.Search object to load the saved query with the UUID.

  3. Call the get() method to retrieve the saved query structure.

All of these methods are static methods.

Once you have the query structure, you can use it to construct a QUERY request parameter.

The following JavaScript example illustrates the procedure for launching a saved query:

function runQuery4() {
  var textField = document.getElementById("savedQueryToRun");
  var queryName = textField.value;
  var queryUUID = JUICE.IDM.Entities.Search.getUUID(queryName);
  JUICE.IDM.Entities.Search.load(queryUUID);
  var myQuery = JUICE.IDM.Entities.Search.get(queryUUID);
  
  openSearchResults("QUERY=" + myQuery);
}