sn-record-picker display-field needing to be a reference field

xiaix
Tera Guru

Here's a head-scratcher...

I have a table:   u_bcp_sites

I have a reference field on this table (u_location) which references the cmn_location table.

My Service Portal widget HTML Template code:

<sn-record-picker field="BCPSite" table="'u_bcp_sites'" default-query="'u_locationISNOTEMPTY'" display-field="'u_location'" value-field="'sys_id'" search-fields="'u_location'" page-size="10" ></sn-record-picker>

Well of course the field results are all blank, because I need the getDisplayValue() of the u_location field.

Too bad we can't do something like this:  

display-field="'u_location.getDisplayValue()'"

So... any way to get this to work?

(tapping nathanfirth lightly on the shoulder )

1 ACCEPTED SOLUTION

Odd.... this works:



find_real_file.png





Why am I able to dot-walk for search-fields but not display-field???


View solution in original post

10 REPLIES 10

larstange
Mega Sage

Hi



Lets say the display field of your table is called "u_name"



Then you should be able to do a display-field="u_location.u_name"


Oh how I wanted this to be the correct answer.  



Alas... u_location.name   I still get no display in the drop down.



find_real_file.png



find_real_file.png





find_real_file.png




And when I click the magnifying glass:



find_real_file.png





When I choose one:




larstange
Mega Sage

Hi David



I would make a "shadow field" then. Simply create a new string Field "Location Name" on the BCPSite table and a business rules which filll out this field every time the location changes. It just sets the display value of the location into the field.


You can also make it as a calculated field.


Yeah, that's what I was trying to avoid....