Modify Search Request?

  • 1
  • Question
  • Updated 2 years ago
Is it possible to modify a search entry before it hits the database?  I'll give an example of what we're doing below.

In our salesforce we house Store Numbers, they are formatted with 6 digits, so examples include 003904, 002112, 032394, etc.

We have a request that if a user enters "3904" that it should pull up "003904", right now it does not.  

Is there a way to add those leading 0s before the request is sent to the database?
Photo of Tyler Neal

Tyler Neal

  • 760 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
What kind of component are your users using to perform their search?  Reference field?  Table search box?  Search Component?
Photo of Tyler Neal

Tyler Neal

  • 760 Points 500 badge 2x thumb
Sorry should've specified!  It's the Search Component, not a table search or etc.
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
My search component, on a Products object, is doing what you describe.  For example, I type in '048' into the search box and I get product AE048XC521EA1 returned.




How do you have your Search Component set up?  Maybe post a screen shot of that?  In mine, I have the return fields of {{Name}}, {{Id}} and {{Description}} all being returned.

I also have mine set up to search "All Text Fields" on the Basic tab of the search component properties.

I've not had luck modifying the search input beyond this.  We had a case with External objects where the external data source had mixed case data, but the user might type in all lower case.  It would not return that as a match.  It worked fine for standard SF objects, but not external objects.  We never figured out a way to get around this (ended up just bringing the data into Salesforce via middleware instead.)
Photo of Tyler Neal

Tyler Neal

  • 760 Points 500 badge 2x thumb
Hi Chandra,

Thanks for the detailed reply.  Here is what I'm seeing:

Doing a search for "2113", notice that the store "002113" does not show up.  Note that this is the "View All" link when searching as shown below.  This is not a table component.





Doing a search for "002113", the store "002113" now comes up.



Here is how my search component is setup:




Hope this helps, let me know if there is anything else that would help.

Thanks!
(Edited)
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Is Store # the name field on the object?  Or a custom field?
Photo of Tyler Neal

Tyler Neal

  • 760 Points 500 badge 2x thumb
Hi Chandra,

Sorry for the delay.  It is the name field on the object.

Thanks,