
Relationship forms allow you to extend the amount of information captured about an item in a relationship tab. They are particularly useful when the main item has many property/fields, or if section properties need to be displayed by type using relationship tabs.
The following example will show you the ins and outs of relationship forms. It uses a Help Ticket item that captures and displays Company information about the item on a Company tab.
This week's Tech Tip Thursday is geared toward our tech-savvy readers. The language and intent is for those with a technical understanding of Aras Innovator vs a business perspective. In other words, don't try this in production or without adult supervision!

- Create a new form to be used by the relationship tab control. The name (not Data Source) of each field element on the form must be the same name as a property on the parent item (to store the value on the main item).
For example: a string property named company_name is created on the Help Ticket item to refer to the field element company_name on the form as shown below.

- Create the following Client Side JavaScript Method named TabFormFieldChanged:
var field_name = this.name;
var property_value = this.value;
document.thisItem.setProperty(field_name, property_value);
- Create the following Client Side JavaScript Method named TabFormPopulateFields:
for(i=0; i<document.forms(0).elements.length; i++)
{
var e = document.forms(0).elements[i];
if (e.name == "" | e.name==undefined) {
//these are internal properties - do nothing
}
else {
//get value of property from parent item
e.value = document.thisItem.getProperty(e.name, "");
}
}
- Attach the TabFormFieldChanged Method to the onChange event of each tab form field that will have data entered/changed by a user:

- Attach the TabFormPopulateFields Method to the onFormPopulated tab Form Event:

- Establish a relationship between the parent item and a related item. The actual relationship to the related item will not be used but the RelationshipType template is needed to modify the tab view. In this example, a relationship is established from the Help Ticket and named Help Ticket Company. (You can also use a "NULL" relationship if you prefer.)

- Edit the RelationshipType template created from the previous step and modify the Relationship View to use a form. In this example, a form named Company is used for the tab view rather than the standard relationship grid.

- As a user enters data into a tab form, the corresponding properties are set on the parent item. When the item is saved, all data is captured in a single transaction to the main item.

Of course, this is just the tip of the iceberg on utilizing relationship forms. Tell us about one of the ways you’ve utilized this or share an idea for a future Tech Tip Thursday. Leave your feedback, tweet me @plmjen or send a message to info@aras.com.
Posted
Thu, Oct 18 2012 9:07 AM
by
Jennifer