Enable ServiceState support for the ContactManager search screens

In the first step of this search example, you add support for the ServiceState property to enable its use in the ContactManager search screens.

Before you begin

Before you start this step, see the description of <ArrayCriterion> in Overview of adding search capability in ContactManager.

Procedure

  1. In Guidewire Studio for ContactManager, in the Project window, navigate to configuration > config > Extensions > Entity and then double-click ABContactSearchCriteria.etx to open this entity in the editor.
  2. Right-click nonPersistentEntity (extension) at the top of the Element hierarchy and click Add new, and then choose typekey from the drop-down list.
  3. Enter the following values:
    Name Value
    name ServiceState
    typelist State
    desc State where contact provides services
  4. In the Project window, navigate to configuration > config > search and double-click search-config.xml to edit the file.
  5. Increment the version attribute in the SearchConfig element at the top of the file.
    In the following example, the original version number was 1 and has been changed to 2.
    <SearchConfig
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="search-config.xsd"
      version="2">
  6. Press Ctrl+F and enter ABContact to find the <CriteriaDef> element for the target entity ABContact.
  7. Add a new <ArrayCriterion> element to the end of this <CriteriaDef> element, as follows:
    <!-- Search by ABContact Fields -->
      <CriteriaDef entity="ABContactSearchCriteria" targetEntity="ABContact">
        <Criterion property="TaxID" matchType="eq"/>
        <Criterion property="VendorType" matchType="eq"/>
        <Criterion property="VendorAvailability" matchType="eq"/>
        <Criterion property="Keyword" matchType="startsWith"/>
        <Criterion property="KeywordKanji" matchType="startsWithCaseSensitive"/>
        <Criterion property="Score" matchType="ge"/>
        <!-- Some additional search criteria are defined in code -->
        <ArrayCriterion property="ServiceState" 
                        targetProperty="ContactServiceArea"
                        arrayMemberProperty="ServiceState" />
      </CriteriaDef>

    The attributes of the new element are:

    property
    The name attribute for the column in the ABContactSearchCriteria entity
    targetProperty
    The name of the array on the base entity ABContact
    arrayMemberProperty
    The name of the column on the extension array entity ContactServiceState

What to do next

Add ServiceState search support in ContactManager for core applications