// in case either of these was -1 (wildcard).
// UIQuery.saveUiQuery(delegator, userInfo.getPartyId(), sectionId, UIQuery.LAST_QUERY_NAME, querySaveMap);
UIQuery uiQueryLast = new UIQuery("",
uiWebScreenSection.getSectionId(), userInfo.getPartyId(),
UIQuery.LAST_QUERY_NAME, uiQuery.getUiQueryValueList());
String lastQueryId = uiQueryLast.save(delegator);
// if the query was not saved, set the queryId to be returned to lastQueryId so that the query parameters
// can be used when displaying the page (Primarily to set the params on the next and previous buttons for multi-page datasets
if ( queryId == null || queryId.equals(""))
queryId = lastQueryId;