Aras Fundamentals: Adding Relationships to ItemTypes

Aras Fundamentals: Adding Relationships to ItemTypes

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:

  1. In the ItemType search grid, search for the Name of the Purchase Order.
  2. Open the Purchase Order ItemType and click ‘Edit’.
  3. Navigate to the RelationshipTypes tab (next to the Properties tab).
  4. 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.
  5. Fill out the table row for the new RelationshipType.
  6. Start by specifying the tab order, we’ll put 10 – though this only matters if we have more than one Relationship. 
  7. In the Name column, enter ‘Purchase Order Part’. 
    • A typical naming convention for RelationshipTypes is to use the source and related ItemTypes’ names.
  8. 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.
  9. 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:

  1. While editing the ItemType, navigate to the RelationshipType tab.
  2. Click on the ‘Add Row’ button  to get a new blank row. Note that the far-left column has the ‘Null Relationship’ icon. 
  3. Fill out the table row.
  4. Start by specifying the tab order as 20.
    • This will make the Comments tab come after the Part List tab.
  5. 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.
  6. Enter the Tab Label, we’ll set this to ‘Comments’.
  7. The name column stays blank for a Null Relationship.
  8. 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: 

  1. In the ItemType search grid, search for ‘Purchase Order Comments’, which was just created when we saved the parent ItemType.
  2. Open the Relationship ItemType and click on the ‘Edit’ button.
  3. Optionally, we can add singular and plural labels to make the table title clearer.
  4. In the Properties tab, click the ‘Add Row’ button.
  5. 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.
  6. Change the Label to something more readable, like ‘Comment’. This will be the table header in the Relationship’s tab.
  7. 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.
  8. Make the property visible to the user, by ensuring the boxes under ‘Hidden’ and ‘Hidden2’ are unchecked.
  9. Optionally, set the default Width of the column to a value like 200 so more of the comment can be read in the table.
  10. 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.  

  1. Open a Purchase Order Item for editing.
  2. 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.
  3. Add a Null Relationship Item by clicking on the ‘Comments’ tab.
    • Click on ‘Add Row’  and fill out the values with our comment. 
  4. We’re done adding Relationships to this Item, so we can Save and Unclaim the Purchase Order by clicking 'Done'.

In Conclusion

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.