Skip to main content

I have a custom field renderer on a reference field like this:


field.options.template = '{{Patient_Case__r.Patient__r.Name}} exam on {{Timeless_Date__c}}';<br>skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value); 

My search popup has only the Id field.

If I add searchFields to the renderer, like so:


field.options.searchFields = [ &nbsp; &nbsp; &nbsp; &nbsp; {id: 'Id'},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Timeless_Date__c'},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Patient_Case__r.Patient__r.Name'}<br>&nbsp; &nbsp; ];


Nothing changes.

If I add returnFields like so:


&nbsp; &nbsp; field.options.returnFields = [<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Id'},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Timeless_Date__c'},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Patient_Case__r.Patient__r.Name'}<br>&nbsp; &nbsp; ];


Then my search popup doesn’t show any fields at all.

Help?

Hey Matt,
For your reference fields, I think you need an additional property showInSearchDialog. Set this to true for each field you want to show in the search popup. So your reference fields code would change to something like:


field.options.returnFields =  <br>

&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Id', showInSearchDialog: false},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Timeless_Date__c', showInSearchDialog: true}, {id: 'Patient_Case__r.Patient__r.Name', showInSearchDialog: true}

&nbsp; &nbsp; ];

When you say “nothing changes” with the search fields, do you mean things are working as expected, or no? You MIGHT have to specify an additional property for those as well: searchOperator. So this would change your search fields to:


field.options.searchFields = e<br>

&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Id', searchOperator: 'contains'},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Timeless_Date__c', searchOperator: 'contains'},<br>&nbsp; &nbsp; &nbsp; &nbsp; {id: 'Patient_Case__r.Patient__r.Name', searchOperator: 'contains'}<br>&nbsp; &nbsp; ];

Let me know if that helps.
Emily


The ‘showInSearchDialog’ parameter did the trick. Thanks!

Now let’s document that somewhere, shall we? 😉


Matt,
Agreed! I’ll mention it to our docs team. The way I figured out the extra properties was by adding some search fields in the builder and running a custom renderer on the field that simply console.log’s the field to see the options. Not as ideal as documentation, though…
Emily


nice trick! thanks.


Reply