Creating a Relationship

,

At this point, you only have one object defined, so you will have to create another object to implement any relationships. The Position object is used to hold information about positions at Universal Containers, such as a description of the job.

1.
Return to the Setup menu and click Setup Create Objects New Custom Object.

2.
Give the new object a Label of Position, a Plural Label of Positions, and a Description of Position to be filled.

3.
Set the Record Name to Position ID, the Data Type as Auto Number, the display format to POS-{00000}, and the Starting Number to 1.

4.
Allow reports, activities, and field history tracking for the Position object, allow Notes and Attachments, and choose to launch the Custom Tab Wizard after creation.

5.
Click Save, which will launch the Tab Wizard. Select an appropriate Tab Style, such as the Treasure Chest, and click Next.

6.
Leave the default visibility of the tab as Default On and click Next.

7.
Since you will only want to display this tab as part of the Recruiting application, click Include Tab to deselect all the custom apps and then the Recruiting app checkbox to include this tab as part of your new app. Click Save to add the tab to your application. The main page for the Position Object displays.

You can create a relationship in the same way that you created fields for the Location object.

Voice of the Developer

When setting up master-detail relationships, you should keep in mind that the relationship between the master object and the detail object is expressed by adding a field to the detail object and not, as you might expect, the master object.


1.
Click New in the Custom Fields & Relationships section.

2.
Select Lookup Relationship as the data type for the field and click Next. The next page prompts you to select the parent object for this relationship.

3.
Select the Location object and click Next.

4.
Give the relationship a Field Label of Location, and a description and help text of The location of the position. Click Next.

5.
In the next page, accept all the default field-level security settings and click Next.

6.
The next page asks you if you want to include the new field as part of the page layout for the Position object. Accept the default and click Next.

The next page, shown in the figure below, is new to you.

This page asks if you want to include the related list in the page layouts for the parent object. Even if you don’t add the related list to the page on this page, you could always go back to the page layout and add it.

Figure 34. Adding related lists to page layouts


7.
Click Save and New to save this relationship and start to define another one.

The lookup relationship to the Location object provides a simple user interface allowing your users to only select a valid location for a position. The next relationship you add associates each position with a hiring manager. The potential hiring managers are already defined in the User object, which contains all current users of your organization, so you can leverage an existing standard object to implement this relationship.

8.
Select the Lookup Relationship data type again and click Next.

9.
This time, select the User object as the related object and click Next.

10.
Give the new relationship a Field Label of Hiring Manager, and a description and help text of The hiring manager for the position. Click Next.

11.
Accept the default field level security and placement on both the Position and User pages. Click Save to finish the creation of the new relationship.

Once again, you can quickly see the result of your most recent work.

12.
Click the Positions tab to bring up the view on the initial page and click New to display the page shown below.

As expected, the two lookup fields, with their search buttons, are on the page.

Figure 35. Lookup fields in a page


13.
Enter values for the location and a hiring manager for the position, using the lookup search capability, and save the record.

14.
Click the link for the Location list to see the related list of Positions on that record detail, as shown in the following figure.

Figure 36. A related list


Adding relationships with a few mouse clicks results in quite a bit of functionality in your application. For any type of real-world application, you need to add more fields to the Position object.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.100.233