Extend the Contact entity with a new name column

About this task

If you extend the Contact entity or a subtype of Contact to add a new name column, you must make the following changes in PolicyCenter.

Note: In ContactManager, you would be extending the ABContact entity or a subtype of ABContact to add a new name column

Procedure

  1. Add the new field to the Contact or the Contact subtype and ensure that the integration files are correctly set up.
  2. Update the class NameOwnerFieldID to add the new field.
    1. Add a variable for the new column to this class.
    2. Add the variable as needed to any of the following existing constants that list name fields in this class:
      ALL_PCF_FIELDS
      ALL_CONTACT_PCF_FIELDS
      REQUIRED_NAME_FIELDS
      DISPLAY_NAME_FIELDS
      FIRST_LAST_FIELDS
      HIDDEN_FOR_SEARCH
  3. Add the new field to one of the following interfaces:
    • For a non-person contact, add the field to ContactNameFields.
    • For a person contact, add the field to PersonNameFields.
  4. Compile the project to see which name delegate classes you need to update.
    For name delegates that take their values from a contact or person, you will see error messages identifying those classes.
    • You will need to add the field to either ContactNameDelegate or PersonNameDelegate, depending on whether you added it to ContactNameFields or PersonNameFields. In ContactManager, these classes are ABContactNameDelegate and ABPersonNameDelegate.
    • For the remaining name delegates, decide if the new name column needs to be added to the underlying entity.
    • There are several non-persistent entities used for searching. If the new column will not be used for searching, create a getter for the field that returns null and a setter for the field that throws an exception. For example, MiddleName is not a search column in the base configuration. For an example, see the implementation of MiddleName in gw.api.name.PLContactSearchNameDelegate.
    • For persistent entities, you can add a new column to match the column you added to the Contact or Contact subtype. Then you create a getter and setter for the field in the associated name delegate. If you do not add the column to the persistent entity, create a getter for the field that returns null and a setter for the field that throws an exception.
  5. If necessary, add a localization_localeCode.xml file for the region and then add the new field to it. Also, update the existing localization_localeCode.xml files with the field. See Configuring the Localization XML file for names.
  6. Add the field to the appropriate modal contact input set files, GlobalContactNameInputSet or GlobalPersonNameInputSet.
    Add new fields as needed to these PCF files. For example, if the new name column applies only to persons, change only the GlobalPersonNameInputSet modal files as needed.

    You might not have to change the file for all modes. Configure your new fields by following the pattern of the existing fields in the file.

    See Modal PCF files and name configuration.

  7. Use the new field in the NameFormatter class.

    In the internalFormat method, add a call to append for the new field. Add the append call to the if statement for the mode value that matches the region for the new field. Follow the pattern used for the other regions and fields. The fieldid values are defined in gw.api.name.NameOwnerFieldId. See NameFormatter class.

  8. Find display names that use the NameFormatter class.

    Press Ctrl+Shift+F and search for NameFormatter with Scope set to All Places and File mask set to *.en.

    • The following list shows the display names that use NameFormatter in the base configuration of PolicyCenter:
      CommercialDriver.en
      Company.en
      Contact.en
      Place.en
      PolicyContactRole.en
    • The following list shows the display names that use NameFormatter in the base configuration of ContactManager:
      ABCompany.en
      ABContact.en
      ABPlace.en
  9. Add the new field as needed to the entity display names that use the NameFormatter class.
    In the Entity Names editor, add the field both to the list of fields in the table at the top of the screen and to the code in the lower text entry area.
    Note: If the new name field applies only to persons, you need to add the name field to Contact.en but not to Company.en or Place.en
    For example :NewFieldName = newFieldName.