The CreatorCon Call for Content is officially open! Get started here.

Help with a Set Filter Script Please

Wendy Peterson
Giga Guru

I have a filter that sets a script on a list collector and now i need to add another condition

I thought by just adding the && it would work but it didn't - Can you tell me what I am doing wrong to get both those conditions in there. TIA

function onLoad() {

      //Apply a default filter to the list collector variable

      var collectorName = 'database_name';

      var filterString = 'u_database_request=true&&type=Microsoft SQL Server';

      //Hide the list collector until we've set the filter

      g_form.setDisplay(collectorName, false);

      setCollectorFilter();

   

      function setCollectorFilter(){

            //Test if the g_filter property is defined on our list collector.

            //If it hasn't rendered yet, wait 100ms and try again.

            if (eval('typeof(' + collectorName + 'g_filter)') == 'undefined' ) {

                  setTimeout(setCollectorFilter, 100);

                  return;

            }

            //Find the filter elements

            var fil = gel('ep');

            //Hide the filter elements by un-commenting the following lines

            /*fil.rows[0].style.display = 'none';

            fil.rows[1].style.display = 'none';

            fil.nextSibling.rows[0].style.display = 'none'; //Filter description text*/

     

                  //Reset the filter query

            eval(collectorName + 'g_filter.reset()');

            eval(collectorName + 'g_filter.setQuery("' + filterString + '")');

            eval(collectorName + 'acRequest(null)');

            //Redisplay the list collector variable

            g_form.setDisplay(collectorName, true);

      }

}

2017-01-31_8-51-10.jpg

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Try replacing the && with ^


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Try replacing the && with ^


Thanks alot that worked


venkatiyer1
Giga Guru

HI Wendy,



Please replace u_database_request=true&&type=Microsoft SQL Server with u_database_request=true^type=Microsoft SQL Server. It should work.