Search Field Showing Record IDs in the Result List

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a search field looking at three objects, Account and two custom objects. When searching on one of the custom objects and the Account object, results appear correctly under the search field. Results coming from the second custom object are showing the record ID rather than the name. Both custom objects look up to the Account object. I would like to see the account name from the Account object when returning a match to the second custom object, just as it does with the first custom object.

Clicking View next to the object name field shows a list of the results with the name displayed.

Any ideas?

Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
How is your search component configured?
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
I have a suspicion that the Field you're returning on your object is set to Id instead of Name

Here is how I have mine set up. If I switch the Fields to "Id", mine will look like yours.
(Edited)
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
Hey Stephen. Thanks for getting back to me so quickly. I actually have that set to display the name. In the first two objects, the field name is just NAME. However, it's a little different with the second one. See below
.
(Edited)
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
Is it possible the problem is that I am not using the "Name" field from this custom object, but rather the "Name" field of the object (Account) it is looking up to?  In the other two scenarios, I am using the Name field from the object itself and they are displaying correctly.
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Could be. What happens if you try that?
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
Well, changing it to the Name field (which in this case is an auto-number) gives the correct value.  However, I need the Account Name to be the result.  Even though the Account Name is accessible via the selector, it appears that any field other than the object's "Name" field shows only the record ID.  We just installed version 9.5.3.  Is it possible this is a bug?
(Edited)
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
What do you mean by "gives the correct value"? 

Have you gone through this? http://help.skuid.com/m/components/l/379149-create-your-own-global-search-with-the-search-component
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
By "correct value" I mean that it shows the value in the object's "Name" field, which in this case is the auto generated number assigned to that record.  I had previously reviewed the article you referenced, but it doesn't provide much in the way of guidance to get a specific value in the results list.  This is really all it has to say:
  1. Use the picklist to add Fields. These fields will be available in your Display Template and also in merge syntax for your Global Actions, Select Actions and object-specific actions.
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
Still trying to figure this one out.  Anyone else have some guidance to share?
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Khamla was able to help me look into this for you, together we found this:

The only way that I can have the search function for names but then show something else is if I have the Fields searched for properly but then have the display template have a merge syntax for what I want to appear. 

Have you tried playing with that?



For this set up, it'll return the Field Name when being searched but instead of seeing the Name, I'll see the Id for the name. 
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
Ok so when I added the {{Client__r.Name}} to the Display Template, the results started showing the client name.  WOO HOO!  However, the top of the results listing shows the number of results from that object with a link to (View).  When I click on View, rather than seeing the complete list of fields in my Fields list, it shows me everything BUT the name field.  SO CLOSE!
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
The Client__r.Name type approach, where we have it show something from another model, I have not been able to make work.
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
In this particular page, there is only one Model and it's pointed at the User object.  Is it possible that I need to add a second model to the page that references the object that's giving me an issue?
Photo of Khamla Phimmachack

Khamla Phimmachack, Official Rep

  • 1,536 Points 1k badge 2x thumb
It wouldn't hurt to try adding a second model, not sure if that will make a difference. Would you mind sending a screenshot of what it looks like after you click (View)?
Photo of Paul Ginther

Paul Ginther

  • 896 Points 500 badge 2x thumb
Hey Khamla.  I think the issue was that the fields I needed were in a lookup relationship with the RCI object I am using in the search Return Objects.  I ended up adding two new custom formula fields to the RCI object that bring the account name and record type name into the RCI record.  I then used those in the Fields list rather than using the lookup relationship.  It's not exactly elegant but it now returns the fields I need.  Thanks for all of your assistance with this!