Including a Location Type field in WebDrawer

The problem

To include an Additional Field in either the search results or details page in WebDrawer all you need to do is add the field 'Search Clause Id' to the appropriate routeDefault in hptrim.config.  Unfortunately, by default, Additional Fields of type Location will display the Uri, rather than the name.

Recap - hptrim.config settings

Below you can see the two route defaults with two Additional Fields included (PoliceOfficer and DateOfIssue)

<add
  name="Record"
  model="Records"
  template="WDRecordList" propertyValue="Both"
  properties="RecordRecordType,RecordExtension,RecordTitle,RecordNumber,RecordIsElectronic,PoliceOfficer,DateOfIssue"
/>

<add
    name="Record"
    model="RecordFind"
    template="WDRecordDetails"
    properties="NameString,RecordIsElectronic,enabledcommandids,RecordRelatedRecs,RecordIsContainer,RecordIsInPartSeries,RecordRecordType,RecordPrimaryContact,PoliceOfficer,DateOfIssue"
    propertySets="Identification,Locations,Electronic,Action,ChildLists,ChildDetails,Parts,Archiving,Container,Other"
/>

The solution

The solution is to tell WebDrawer what sort of string value you want displayed, for Locations the default will be a Uri, to get the name use "TreeColumn" or "ViewPane", this will affect all of the properties so have a look at the results you get for various property types and make your choice. 

<add
  name="Record"
  model="Records"
  template="WDRecordList" 
  stringDisplayType="TreeColumn"
  properties="RecordRecordType,RecordExtension,RecordTitle,RecordNumber,RecordIsElectronic,PoliceOfficer,DateOfIssue"
/>

<add
    name="Record"
    model="RecordFind"
    template="WDRecordDetails" 
    stringDisplayType="ViewPane"
    properties="NameString,RecordIsElectronic,enabledcommandids,RecordRelatedRecs,RecordIsContainer,RecordIsInPartSeries,RecordRecordType,RecordPrimaryContact,PoliceOfficer,DateOfIssue"
    propertySets="Identification,Locations,Electronic,Action,ChildLists,ChildDetails,Parts,Archiving,Container,Other"
/>
Written on September 29, 2016