Search Component - Filter

LOVE the new Search component.  Is there a way to limit the results the users will get from a certain object?  For example… I am build a CPQ proof of concept.  I’m using the Search Component to search on the Products object, but I only want my users to see Product results where Active = TRUE.  (As well as other filters.)  Possible?

Chandra, this is not currently supported via the Page Composer, but once we release Banzai Update 2 (at the end of this week), there will be a supported way to do this via XML, which I’ll share with you now even though it is not going to work until you get Banzai Update 2:

  1. Click to edit your page’s XML (bottom right corner of Page Composer)
  2. Find your Search component within the XML by looking for “search”, you should see something like this:

  1. Now find the node corresponding to the Product2 object, and find the tag. Immediately after the tag, and copy in the following XML:
<condition type="fieldvalue" field="IsActive" operator="=" value="true" enclosevalueinquotes="false"/>
  1. Save your page.
  2. Wait till Banzai Update 2 comes out, and then try your search again — assuming that your searching on the Product2 object, your records should be limited to just those Product2 records where the IsActive field is true.

Just had the same issue. Needed to filter and was going to add this as an idea.

Implemented and works as expected.



This reply was created from a merged topic originally titled Search Box - Adding a WHERE condition to the SOSL Query. It’d be helpful for me to specify a WHERE statement to the SOSL query in the search component. This seems fairly straight foward given SOSL syntax.

FIND {Joe Smith}
IN Name Fields
RETURNING lead (name, phone Where createddate = THIS_FISCAL_QUARTER)

Here’s my XML:

<search uniqueid="sk-1pOUMT-385" soslfields="Name Fields" limit="5">                                 
                                    <object id="Phrase_Template__c" displaytemplate="{{Text_English__c}} {{Phrase_Type__c}}">
                                          <field id="Phrase_Type__c"/>

Is there a way to write in a WHERE statement in <field id="Phrase_Template__c"/>?

Griffin, I merged your question into Chandra’s question - this can be done right now via XML, as described above.

Hey Zach … I tried this and it works well. I have two other wishlist items for Search and was wondering if these can be tackled in the XML also:

  1. Can we rename an object in the results? e.g. I’ve put a condition on the Account object results so that they only return clients. Would be great to rename the label for that object to Clients.
  2. Can we reuse the same object twice with different conditions? e.g. I want to search for clients as above, but I also use the Account object to store service providers, so I want to reuse Account, but with a different condition and label.

Did we ever find out the answers on this?

Also, can we do the following:

  • Sort the results
  • Filter based on a value from a model

I used Zach’s XML and it worked like a charm. However, perhaps future versions of search could be based on a model instead of the object directly. Then you could build a model with all kinds of conditions and sorting.

“perhaps future versions of search could be based on a model instead of the object directly”

I agree. That would be ideal, and consistent with the rest of Skuid.

Hi I always want to return a specific record from Account plus what ever user searches for. So I added two account object under Return objects. For one of them, I added

But searching is not working. How can I fix it? Thanks!

Hi Zach,
Are you able to re-supply the XML as it does not appear on this post any more (amybe since the Community was updated)?

Hey @Rob_Clough !

Just looked at the post and saw the issue(mis-formatted during the migration rendering it invisible). I was able to reformat it correctly so you should see it now.