Controlling fields take advantage of parent-child relationships and many-to-many relationships to provide easier, less error-prone data entry when creating or editing object records. This article explains, through examples, how to configure an object’s fields to support controlling field behavior.
Example: Referenced Parent-Child Relationships on the Milestone Object
When Elaine creates a new milestone, she sees fields to select Study, Study Country, and Study Site. At first, the Study Country and Study Site fields are greyed out. Once she selects the correct Study, the Study Country field becomes editable and allows her to choose from the Study Country records that belong to the selected Study. She can’t choose an invalid Study Country because the list is limited to valid options. She sees the same behavior for Study Site, which is controlled by the Study Country selection.
How to Configure
First, you need to ensure that the Study, Study Country, and Study Site objects are in parent-child relationships, with Study as the top level and Study Site as the lowest level.
Once you’ve verified that the object hierarchy is correct, you can create the fields that Elaine saw when she created a new milestone. Go into the Milestone object configuration and add new fields with the Object type. By creating these fields, you’re creating new reference relationships:
- Milestone to Study
- Milestone to Study Country
- Milestone to Study Site
The first field you create must reference the Study object because that is the highest-level object in the parent-child hierarchy and therefore does not have a controlling field. You have to create the highest level first because the field must already exist in order to control another field.
The second field you create should reference Study Country. Once you’ve selected Study Country as the referenced object, Vault displays a new option: Controlling Field. When Elaine is editing the Study Country field on her milestone, the controlling field specified here will determine what options are available to select. The controlling field must reference a field related to the parent object. In this example, Study is the only option. When you create the Study Site field, Study Country will be the controlling field.
Example: Referenced Many-to-Many Relationships on the Marketing Campaign Object
In Marcus’ Vault, Product and Country are in a many-to-many relationship. This allows Admins to indicate the countries where a product is available by creating a relationship between the Country records and the Product records. For example, Nyaxa is available in Canada, Spain, the United States, the United Kingdom, Germany, and France, but VeevaProm is not available in France and Germany.
When Marcus creates a new marketing campaign, he sees fields to select Product and Product Country. At first, the Product Country field is greyed out. Once he selects the correct Product, the Product Country field becomes editable and allows him to choose from the Product Country records that belong to the selected Product. He can’t choose an invalid country because the list is limited to valid options.
How to Configure
First, you need to ensure that there is a many-to-many relationship where the Product Country object’s parents are Product and Country.
Once you’ve verified that the object setup is correct, you can create the fields that Marcus saw when he created a new campaign. Go into the Marketing Campaign object configuration and add new fields with the Object type. By creating these fields, you’re creating new reference relationships:
- Marketing Campaign to Product
- Marketing Campaign to Product Country
The first field you create must reference the Product object because that will be the controlling selection for the Product Country field. You have to create the controlling field first because the field must already exist in order control another field.
The second field you create should reference Product Country. Once you’ve selected this as the referenced object, Vault displays a new option: Controlling Field. When Marcus is editing the Product Country field on his campaign, the controlling field specified here will determine what options are available to select. The controlling field must reference a field related to the parent object.
When setting up controlling fields for objects in a many-to-many relationship, the first (controlling) field must reference one of the two parent objects (Product or Country) and the second (controlled) field must reference the relational child object (Product Country). If you wanted to, you could also set up these fields so that Marcus selects a country and then sees a list of products available for that country. In that setup, the first field you create would reference the Country object and the second, like before, would reference the Product Country object.