|
Adding a Relationship
There are several different types of relationships that you can choose from, and each relationship type will have different behavior. For more information, see Relationship Types.To Add a Relationship to a Custom Class
2. Select the Customization Center view.
3. Click Lock for Customization. The APM icon in your Taskbar now has a key on it:If either class is not already customized, click New Custom Class then select Based on APM Class. Select the class, and then click OK.
6. On the first custom class (for example, the Work Request class) select the Data Members view, Custom Relationships tab.
7. Click New. The Relationship dialog appears.
8. In the Type of Relationship box, select the kind of relationship that you want to create.For this example, select References one.
9. In the Related class box, select the custom class to which this class will relate. Only custom classes are available for selection. You cannot create a custom relationship to a base class.For this example, select the Warranty class.
10. In the Relationship description box, type an appropriate description of the relationship. This is the text that will appear by default when you add the relationship to the UI.If you choose the Mandatory option, the field is red-lined when left blank. An error message displays if the user tries to save or close the object when the field is blank.If you select the Warning option, the system marks the field with a yellow-line and displays a warning message if the user tries to save or close the object when the field is blank.
12. If you are working with a custom Indicator class, Supports mass update is available for Owns Many, References Many, References One, and Contains One relationships. Select this option if you wish to make the relationship available for mass update requests. Unless the relationship is References One, the Msg list appears.You must create an informational message on the related class to display the value that will appear in the Values to Copy window of the Indicator Mass Update wizard. Then select the message from the list. For example:
13. On the Inverse tab, you can edit the relationship description and characteristics for the inverse part of the relationship. This determines the UI text and behavior of this relationship on the opposite class (the class at the other end of the relationship).
14. On the Validation tab, Site Restrictions tab, you can set up site restrictions for the relationship. Enter the appropriate settings:
Note: You can also define custom validation rules and messages. For detailed instructions, see Creating Custom Validation Rules for Relationships.
15. On the Deletion Rules tab, you can set the desired behavior for when an object from the custom class or the related class is deleted.
16. On the Specifications tab, you can enter a detailed description of the relationship.Note: On the States tab, you can review the state groups in which this relationship is included. To create custom states for the relationship, see Creating Custom States. On the Usage tab, you can review the views where the relationship appears in the user interface.
17. Click OK to save the relationship.Adding the Relationship to the UI
18. In the class in which you are working, select the User Interface view.
19. Open the view to which you want to add the relationship. If the view has not yet been customized, click Customize, select the view or panel that you want to customize and a Customization type, and then click OK.For this example, you will customize the Work Request Properties view.If the view you are working with contains panels, you must turn on the Design this panel option. To do this, right-click the view and select Design this panel from the menu that appears.
20. Find the relationship in the Toolbox panel, Relationships tab (for example, “Applicable Warranty”) and drag it onto the view. The type of control that appears on the view will depend on the type of relationship that you selected. For example, if it is a references one relationship, it will appear on the view as a label and a Browse button.Tip: To quickly arrange fields and/or labels in a window, you can use the Layout Options menu items. Select two or more items in the window and then select a layout option from the menu.Click the Browse button. The properties for the reference are detailed in the Properties panel. Expand the Data section.
23. Click the box beside First Attribute. The dropdown list displays attributes that are available from the Warranty class. Select Title.
24. Most assets will not have a large number of warranties to choose from, so we will change the control from a Browse button to a dropdown list. In the Properties panel, Layout section, click the box beside Button Style and select DropDown.
25. Because users can resize the Work Request Form, you need to make sure that the Applicable Warranty field moves appropriately within the form. In the Properties dialog, Layout section, click the box beside Anchor and click the dropdown arrow. A Selector appears.
27. Move the Applicable Warranty field underneath the Hierarchy location field (in the Asset to Work on section of the General tab). To do this, you will first need to move some of the other fields down. You can also resize the Applicable Warranty field to match the sizes of the other fields in the view. When you are finished, the dialog should look similar to this:
29. In the Customization Center, click Unlock System. The system should automatically regenerate the schema and cache files. This may take a few minutes.Note: If the system does not automatically generate the schema and cache, click Generate and then Schema, and Generate and then Cache Files in the Customization Center.
30. Now you can test your customizations. Open the site and then navigate to your custom view. For example, select the site’s Work Request view and then open a work request. Make sure that Allow Editing is enabled. Your custom field should now appear on the Work Request window’s General tab. To test the field, click the down arrow and select a warranty. (Make sure that the asset to work on for the work request actually does have at least one warranty.)