In this Fundamentals article, we’ll go over how to add a Relationship to custom or default ItemTypes in Aras Innovator. In a previous Aras Fundamentals blog post, we created an ItemType called Purchase Order. And today we’ll be expanding on that ItemType by adding two new Relationships to it. For our Purchase Orders, we want to be able to add a list of Parts associated with the Purchase Order and add comments to the Purchase Order along the way. The first use case requires adding a Relationship to an ItemType, and in the second case we will add a Null Relationship.
What does a Relationship do and why would we want to relate one Item to another, anyways? A Relationship is an Item that connects two Items. Because it’s separated from the source and related Items, it has its own properties, rules and actions – all of which can be customized independently. An Item could link to the most recent version of the related Item or the related Item’s version at the time when the Relationship was made. The specifics of customizing a Relationship’s functionality are beyond the scope of this article, so for now we’ll focus on creating basic Relationships.
Adding a Relationship
Let’s start by adding a Part List to the Purchase Order. The Purchase Order is going to be used to keep track of the Parts requested by one of our customers, so we need some way to store which Parts have been requested. The easiest way to do this is to add a Relationship pointing to Parts by following the steps below:
- In the ItemType search grid, search for the Name of the Purchase Order.
- Open the Purchase Order ItemType and click ‘Edit’.
- Navigate to the RelationshipTypes tab (next to the Properties tab).
- Click on the ‘Select Item’ button to define a new RelationshipType. In the search dialog, search for and select the ‘Part’ ItemType by its name.
- Fill out the table row for the new RelationshipType.
- Start by specifying the tab order, we’ll put 10 – though this only matters if we have more than one Relationship.
- In the Name column, enter ‘Purchase Order Part’.
- A typical naming convention for RelationshipTypes is to use the source and related ItemTypes’ names.
- Enter 'Part List' in the Tab Label field.
- This will be the name of the tab that the user sees when editing the source item.
- Save and Unclaim the Purchase Order ItemType by clicking on ‘Done’.
For each RelationshipType that is created, a Relationship ItemType of the same name will be automatically made. We can add properties and behavior to this ItemType to change the characteristics of the Relationship, as needed. For this Relationship, we don’t need to add or change anything, so let’s continue onwards.
Adding a Null Relationship
Now let’s look at adding a Null Relationship to our Purchase Order ItemType. In a Null Relationship, the RelationshipType has a source ItemType, but no related ItemType. This RelationshipType structure is useful when we need to track items that pertain only to the source item and won’t be reused. For example, we want to add a way to attach comments to our Purchase Orders. The steps to create a new Null Relationship are:
- While editing the ItemType, navigate to the RelationshipType tab.
- Click on the ‘Add Row’ button to get a new blank row. Note that the far-left column has the ‘Null Relationship’ icon.
- Fill out the table row.
- Start by specifying the tab order as 20.
- This will make the Comments tab come after the Part List tab.
- Enter ‘Purchase Order Comments’ as the name for the RelationshipType.
- A good naming convention is to use the source ItemType’s name and a descriptive name of the new Relationship.
- Enter the Tab Label, we’ll set this to ‘Comments’.
- The name column stays blank for a Null Relationship.
- Save and Unclaim the ItemType by clicking ‘Done’.
We want this Relationship to record comments, so we need to add a property to the Relationship to hold that information. Here are the steps to add a comments property to the ‘Purchase Order Comments’ Relationship ItemType:
- In the ItemType search grid, search for ‘Purchase Order Comments’, which was just created when we saved the parent ItemType.
- Open the Relationship ItemType and click on the ‘Edit’ button.
- Optionally, we can add singular and plural labels to make the table title clearer.
- In the Properties tab, click the ‘Add Row’ button.
- Name the property ‘_comment’.
- The underscore isn’t necessary, but it’s an easy way to distinguish system-made properties from ones we’ve added.
- Change the Label to something more readable, like ‘Comment’. This will be the table header in the Relationship’s tab.
- Select Text for the Data Type of the property.
- The comment will be sequence of text without a set length, so the best option here is Text. That way, users can write as much as they need to without being constrained by a character limit.
- Make the property visible to the user, by ensuring the boxes under ‘Hidden’ and ‘Hidden2’ are unchecked.
- Optionally, set the default Width of the column to a value like 200 so more of the comment can be read in the table.
- Save and Unclaim the ItemType by clicking ‘Done’.
Default Structure View
Let’s test out our new RelationshipType by opening a Purchase Order for edit. And … hm, we can’t see the Relationship tabs.
Oh, of course, we forgot to enable the view for the Purchase Order ItemType. That’s an easy fix; we just need to enable the source ItemType to show Relationship tabs when an Item is opened. To do this, we’ll open the Purchase Order ItemType for editing, click on the Default Structure View drop down menu and select ‘Tabs On’. We can then save the changes. Here’s a list of the Structure View options and what they mean:
- ‘Tabs On’ will display all relationship tabs if there are any associated with the ItemType.
- ‘Tabs Off’ is the Aras Innovator default and hides the Relationship tabs from the accordion section of the Item.
- ‘Tabs Min’ adds the relationship tabs to the accordion section but defaults it to closed.
- ‘Tabs Max’ is currently the same as ‘Tabs On’ but may change functionality in the future.
Now that we can see the Relationships for this ItemType, we can test the new RelationshipTypes by adding them to a Purchase Order Item.
- Open a Purchase Order Item for editing.
- Add a Part Relationship Item by clicking on the ‘Parts List’ tab.
- I have a premade Part to use, so we’ll click the ‘Select Items’ button and search for the Part, highlight it by clicking on it, and hit ‘OK’ to add the Relationship.
- If you're following along and don't have a premade Part, you can click the 'Create Item' button to add a new Part on the fly.
- Add a Null Relationship Item by clicking on the ‘Comments’ tab.
- Click on ‘Add Row’ and fill out the values with our comment.
- We’re done adding Relationships to this Item, so we can Save and Unclaim the Purchase Order by clicking 'Done'.
That’s all we need to do to add Relationships to ItemTypes. We also learned when to use standard Relationships versus Null Relationships. The series of Aras Fundamentals blog posts should help with mastering essential techniques for developing in the Aras Innovator system.