C.6 Performing a Search on All Searchable Attributes

You can use the JavaScript API to search all of the searchable attributes for an entity. This type of search only applies to attributes that have a type of string. Therefore, it does not work with DN, date, integer, boolean, and so forth.

To perform a search on all searchable attributes, you create a query object in the same manner that you would using other search techniques (as described above). Then you need to get the list of attributes for an entity definition by calling JUICE.IDM.Definition.load(). Once you have the list of attributes, you need to verify that each attribute is a string and is searchable. For each attribute that is a string and is searchable, you can now add a condition row by calling the addConditionRow() method on the condition group object. When all condition rows have been added, you can execute the search.

The following JavaScript example illustrates how to perform a search on all searchable attributes.

function buildQuery5() {
  var searchStr = document.getElementById("query5Text").value;
  if (searchStr == "") {
    alert("Enter a search string in the text field.");
  var newQuery = JUICE.IDM.Entities.Search.create("My New Search");
  var entDef = "user";
  var selAttrs = new Array();
  var newCondGrp1 = newQuery.addConditionGroup();

  //get all the searchable attributes of entity-definition user that are type string (excludes DN, date, integer, boolean, etc)
  var attrKeys = JUICE.IDM.Definitions.getAttributeKeys(entDef);
  for (var i = 0; i < attrKeys.length; i++) {
    var attrDef = JUICE.IDM.Definitions.getAttribute(entDef, attrKeys[i]);
    var attrType = attrDef.getType();
    var searchable = attrDef.isSearchable();

    if (attrType == "String" && searchable ) {
      var newCondRow = newCondGrp1.addConditionRow();
  openSearchResults("QUERY=" + newQuery);