If you have been playing along at
home, you should now have an external content type defined for
employees in the Adventure Works SQL database, and an external list
that uses the Employee external content type to provide user access to
the employees via SharePoint.
SharePoint allows content owners to define
their data in SharePoint by using an array of site column types and
list templates. Since the introduction of Business Connectivity
Services in SharePoint 2010, content owners can now include site
columns that link to external sources, just as they would use lookup
columns to access columns of another internal list.
Continuing with the example, imagine that Human
Resources wishes to store a list of employee salaries in SharePoint. A
plain list of employee names and salaries with the employee name as
string column is a little dull; besides, HR would like to map salaries
to employees contained in their Adventure Works employee table—your
makeshift HR database, for all intents and purposes. Using external
data columns, you can provide exactly what I just described. Here’s how.
- Open the SharePoint site where you created your external list of employees.
- Create a new run-of-the-mill SharePoint custom list, called Salaries .
- Add a currency site column to the list, called Salary.
- Add a new site column for the employee name, using the external data site column type (Figure 1).
- Click the farthest right icon next to the external content type field.
- SharePoint displays the External Content Type Picker (Figure 2).
- Select the external content type containing the column to map your external data column.
- After SharePoint refreshes the page, you should see a drop-down list of the fields to choose for the external data column.
- Select the column to map. I chose last name.
- Check the check boxes for any additional columns you would like to create additional linked external data columns.
- Click OK at the bottom of the page to finish creating the column.
In the previous steps, you configured a new
list for employee salaries, added a salary column, and created an
external data column, which maps to the employee last name column in
the previous defined Employee external content type. Now, you get to
see the new list with external data column in action.
- Navigate to the Salaries list.
- Click the link to add a new list item.
- In the list entry form, choose the icon farthest from the Employee column.
- SharePoint presents a dialog to select an employee (Figure 3).
Hold on a second! Why is the dialog in Figure 3
showing e-mail addresses? Cast back a few sections to when you created
the external content type for the employee—you selected the e-mail
address column to appear in picker dialogs. You essentially told
SharePoint that you want to identify users via the e-mail address when
selecting from a choice of employees.
- Select one of the employees in the list.
- Click the OK button.
- Since you chose Last Name as your mapped external data column, the
last name of the selected employee shows in the Employee column in the
form.
- Add a salary and a title, then click the Save button to save the list item.