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.
ABContact
to add a new name columnProcedure
-
Add the new field to the
Contactor theContactsubtype and ensure that the integration files are correctly set up. -
Update the class NameOwnerFieldID to add the new
field.
- Add a variable for the new column to this class.
-
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
-
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.
- For a non-person contact, add the field to
-
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
ContactNameDelegateorPersonNameDelegate, depending on whether you added it toContactNameFieldsorPersonNameFields. In ContactManager, these classes areABContactNameDelegateandABPersonNameDelegate. - 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
nulland a setter for the field that throws an exception. For example,MiddleNameis not a search column in the base configuration. For an example, see the implementation ofMiddleNameingw.api.name.PLContactSearchNameDelegate. - For persistent entities, you can add a new column to match the column
you added to the
ContactorContactsubtype. 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 returnsnulland a setter for the field that throws an exception.
- You will need to add the field to either
- 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.
-
Add the field to the appropriate modal contact input set files,
GlobalContactNameInputSetorGlobalPersonNameInputSet.Add new fields as needed to these PCF files. For example, if the new name column applies only to persons, change only theGlobalPersonNameInputSetmodal 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.
-
Use the new field in the NameFormatter class.
In the internalFormat method, add a call to
appendfor the new field. Add theappendcall to theifstatement for themodevalue that matches the region for the new field. Follow the pattern used for the other regions and fields. Thefieldidvalues are defined ingw.api.name.NameOwnerFieldId. See NameFormatter class. -
Find display names that use the NameFormatter class.
Press Ctrl+Shift+F and search for
NameFormatterwith Scope set to All Places and File mask set to*.en.- The following list shows the display names that use
NameFormatterin the base configuration of PolicyCenter:CommercialDriver.en Company.en Contact.en Place.en PolicyContactRole.en - The following list shows the display names that use
NameFormatterin the base configuration of ContactManager:ABCompany.en ABContact.en ABPlace.en
- The following list shows the display names that use
-
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.enbut not toCompany.enorPlace.enFor example:NewFieldName = newFieldName.
