Accessing fields on subtypes

Various entities in PolicyCenter have subtypes, and a subtype may have fields that apply only to it, and not to other subtypes. For example, a Contact object has a Person subtype, and that subtype contains a DateOfBirth field. However, DateOfBirth does not exist on a Company subtype. Similarly, only the Company subtype has the Name (company name) field.

Because these fields apply to particular subtypes only, you cannot reference them in rules by using the primary root object. For example, the following illustrates an invalid way to reference the primary contact for an account:
  • Company.PrimaryContact.LastName.compareTo("Smith") //Invalid
To access a field that belongs to a subtype, you must cast (or convert) the primary object to the subtype by using the “as” operator. For example, you would cast a contact to the Person subtype using the following syntax:
  • (Company.PrimaryContact as Person).LastName.compareTo( "Smith" )