How PolicyCenter traverses the validation graph

If a entity is validatable, PolicyCenter applies the pre-update and validation rules any time that you modify the entity contents directly. Suppose that you update an object linked to another object. For example, a foreign key links each of the following objects to the User object:

  • Contact
  • Credential
  • UserSettings

If you update a user’s credential, you might reasonably expect the pre-update and validation rules to execute before PolicyCenter commits the updates to the database. However, updating a user’s credentials does not normally trigger rules to the container object (User, in this case). The reason, implementation (at the metadata level) of a user’s credential is a pointer from a User entity to a Credential entity.

The standard way to trigger the pre-update and validation rules on linked objects is by setting the triggersValidation pointer (foreign key) to the object in the metadata XML file. For example, in User.eti, you see the following:

<entity xmlns="http://guidewire.com/datamodel" ... entity="User">
  ...
  <implementsEntity name="Validatable"/>
  ...
  <foreignkey columnName="ContactID"
              desc="Contact entry related to the user."
              fkentity="UserContact"
              name="Contact"
              ...
              triggersValidation="true"/>
  <foreignkey columnName="CredentialID"
              desc="Security credential for the user."
              fkentity="Credential"
              name="Credential"
              ...
              triggersValidation="true"/>
  ...
</entity>

Setting the triggersValidation attribute to true ensures that PolicyCenter runs the pre-update and validation rules on the linked object any time that you modify it. (This is only true if the container object implements the Validatable delegate.)

In the base configuration, Guidewire sets the validation triggers so that modifying a validatable entity in a bundle causes PolicyCenter to validate that entity and all its parents.

You can use the triggersValidation attribute on foreign keys and arrays that you add to custom subtypes, to custom entities, or to core entities by using extensions. The default value of this attribute is false if you do not set it specifically. If you want a new foreign key or array element of a validatable entity to trigger validation whenever its linked entities change, set triggersValidation to true.