Skip to main content

We’re using the super-basic salesforce/force.com users for our field users. So I’m making all the objects/tables they will use custom to keep the object count below the limit of 10 custom objects.

I have a ‘settings’ table which contains all the ‘static’ settings.
Specifically, there’s:
- School Type : One record/object per school (duh)
- Class Type : Multiple Classes per School

Making a skuid page to edit the Classes.  I have a “School” field which is a reference/lookup field back into the Settings object, for records of type= “School”

I’m having trouble figuring out how (assuming I can) have Skuid show the school name when you do the lookup for a School field in the class object.

I can see the specific School “Name” field with the auto-number ID, but can’t get the other Display Name field to show.

Presumably I need another model, which I made “Settings-Schools” which filters out only the type “School” settings.  But I’m unclear how to link that up to the lookup for the field.

Is this even possible?  With snippets?

Thanks,
Seth




Hi, Seth,

Let me make sure I understand the setup. You have a single object “Settings”. A Settings record can have a Type of “School” or “Class”. The Settings object has a lookup to itself so that a “Class” Settings can reference a “School” Settings. Does that sound right? If so, I don’t think you will need another model to get the search results you want.


To limit results to Settings of Type = “School”, you can add a lookup filter to your lookup field. This is found on the Filters tab in the field properties. The filter would be Type (or whatever field you are using to determine the type) = “School”.



To display something besides the Name field in the lookup results, go to the Search tab in the field properties. You can determine the display of the search results through a Search Template:



You can choose fields from the field picker to the right of the Search Template body, and then arrange the display for search results. In my example, I am looking up Account records and displaying the results in the format of **{{Name}} ({{Industry}})**.


One thing to watch out for: For whatever fields you are using in the lookup filter or search template, make sure you include these fields from the parent Settings record in your child Settings model. In my case, where I am using Opportunity as the child and Account as the parent record, I have added the Account.Industry field to my Opportunity model since I use it in the search template.


Let me know how that works or if you have any questions!

Emily


Emily,


Yes, you described what I’m wanting to do. But I’m not getting the options you’re showing.


The Setting object is like this. (I setup a look up filter, but it is NOT enabled)

!(https://us.v-cdn.net/6032350/uploads/attachments/RackMultipart20151201-4055-10aspfy-Custom_Object M2Setting_ Salesforce___Enterprise_Edition_inline.png “Image https//d2r1vs3d9006apcloudfrontnet/s3_images/1320918/RackMultipart20151201-4055-10aspfy-Custom_Object__M2Setting___Salesforce___Enterprise_Edition_inlinepng1449003143”)


I setup the filter as you have shown. But when I go to add fields to the search and display template, I don’t really get any fields:


Clicking on the SchoolLink, just keeps adding “> SchoolLink__r” at the top.


But now when I click on the “Select Field To Insert” button I get this. (Option source is “Automatic”, though “Model” with the detail model selected, does the same.




This screen I don’t understand at all. The model has the correct salesforce object name. When I display the page and select a class, it correctly displays the detail model with the fields.


Seth


Seth,

It looks like you need to add the fields that you want to use for your filter into your model. In the model on the M2Setting__c object, click the arrow next to the SchoolLink__c field to see the fields in the SchoolLink__c object. Select any of the fields that you want to use in lookup filters or display templates.

Then you should be good to go!


Thank you Matt and Emily,

Emily had it with 

One thing to watch out for: For whatever fields you are using in the lookup filter or search template, make sure you include these fields from the parent Settings record in your child Settings model. In my case, where I am using Opportunity as the child and Account as the parent record, I have added the Account.Industry field to my Opportunity model since I use it in the search template.
But I thought I understood that, but obviously I didn’t. I also got confused by the “Select an SObject for this model” message I was getting later.  It seems that something was messed on my PC or the servers, because with no changes, that message went away this morning.

Thanks again


Ok, I’m fully confused now. I thought I had this, but it’s not working like expected


I have the reference field lookup setup. I have the fields I’d like to display in the lookup table in the model under the reference field (SchoolLink__r.DisplayName__c, SchoolLink__r.ExternalID__c, etc).


I have the search properties setup as below in the image (the selected fields in the model are on the left.)


The “Search Template” seems to do nothing. Anything I put in there makes no difference with the lookup table view.


If I add the fields to the “Search Fields”, they show up in the lookup table view.


  • I added a filter on some fields and that works perfectly.

Perhaps I’m just totally misunderstanding the “Search Template” field. From Emily’s comment above, and what I recall, it understood that this is were you specify what fields are displayed in the lookup table list.


As I understand it, the ‘Search Fields’ is where I specify which field I want the “Search” field on the lookup table list to search.


What does “Search Template” do?


Thanks, and Merry Christmas…

Seth


Seth,


If I understand it correctly, the search template controls how items are displayed here:


Matt is correct.

You can use “Search Fields” to dictate not only which fields are searched, but also which fields are displayed in the popup lookup table and even which fields are returned to the page when a record is selected (in case you need to pull back other fields to get field templates or conditional rendering to work, etc.)

34d71e9f0223b650a33c1e8866da09abfb480c12.png


For what it’s worth, I’d suggest changing the text of the “Search fields”, which is “Use Search Fields to specify which fields to search on. If you do not specify any fields, all searchable fields will be searched.” to mention that it also controls what displays on the pop-up.  I looked everywhere I could think of to find how to specify the fields.


JD,

So displaying fields on the pop-up is tied to the search type?  If I want to use “Use SOSL to improve search performance” then the pop-up will only show the linked record ID.  



Unfortunately there’s an problem with the Builder that takes away the search fields option for SOSL searches. However, if you’re brave, you can add in search field nodes in the XML for a SOSL search, and it will work correctly at runtime. I think we’ll have this fixed in a patch at some point.


Lost a reply somewhere along the way.

Thanks Matt and JD. My sanity is restored. I could have sworn I added fields to the popup without the “search fields” when we were experimenting with Skuid a year or two ago.

Is it possible to change the pop-up title?  Saying “Select M2Setting ID” isn’t the most descriptive. (It’s the object name)