Referring to the current contact/person in ContactManager on GlobalPersonNameInputSet.default pcf properties

64 Views Asked by At

In ContactManager, trying to make FirstName a required field when creating a new contact but only for ABAdjudicator, ABPersonVendor, ABAttorney, and ABDoctor subtypes of ABPerson. Question is, how to do this? Changing OOTB code in the GlobalPersonNameInputSet.default pcf file, I can make FirstName required with this: not nameOwner.isRequired(gw.api.name.NameOwnerFieldId.FIRSTNAME) in the 'required' field of the FirstName textInput field for all ABPerson types. However I want to restrict only for the forementioned types. I am trying something like this:

contact typeis ABAdjudicator ?: not nameOwner.isRequired(gw.api.name.NameOwnerFieldId.FIRSTNAME)

but 'contact' is not scoped into it so not recognized. Also, once I find out how to refer to the current ABPerson being created/edited, can I list these types of person in some way, as in something like:

contact typeis (ABAdjudicator, ABPersonVendor, AbAttorney, ABDoctor) ?: not nameOwner.isRequired(gw.api.name.NameOwnerFieldId.FIRSTNAME)

Any help is much appreciated. Thank you.

1

There are 1 best solutions below

3
SteveDrippsCentricConsulting On

As you've probably figured out this is a bit more complicated than just checking the Person subtype and then setting the required field to true or false. In order to maintain uniformity of required fields throughout the application these required settings are kept track of in nameOwner gosu classes. I am using class names from ClaimCenter but there should be similar class names in ContactManager you will have to modify:

  • CCContactHandlePersonNameDelegate - add an override property here to return the subtype of the contact
  • ContactNameFields - add the subtype property here so that all classes that have to implement this new subtype property if they are going to function as a Contact Handle Delegate. If you don't do this you would have to check the type of the class and manually cast in a lot of places
  • ContactNameOwner - change the RequiredFields() property to look at the subtype of the ContactHandle before returning the list of required fields.

This is just a starting point and you may need to modify more files than this to get your use case to work.