Cross-site Lookup column for SharePoint 2013 and SharePoint Online in Office 365

In this article I would like to present our new solution Cross-site Lookup for SharePoint 2013 and SharePoint Online in Office 365. With help of this feature you can create lookup columns with quick search and asynchronous loading of results for lists and libraries to link data from any sites within a site collection.

First, I would like to cover the technical aspects of this solution. Our lookup is not a custom field because custom fields can be deployed only as part of farm solutions which are not available for Office 365. So, we made it as a number of JavaScript templates (view, edit, new and display) for standard Lookup field. We used JSLink property of SPField class to inject these templates and Select2 control with some modifications as control for searching and navigating through the source list.

Now I will demonstrate our solution in action. In the root web of the root site collection I created a list of countries. Next I created a new subsite in the same site collection and added a custom list and named it Target. Ok, let’s create a new lookup column in Target list which links to Countries list in the root site collection.

Open the view of Target list and click ‘Plumsail Lookup ‘ button in ‘List’ tab of the ribbon.

If you don’t have the existing lookup column in your list you will see a dialog for creating a new lookup field. Enter the name of this field in text box and click Ok.

After the field has been successfully added you can configure it. First, let’s change the source list. Click ‘Change ‘ link near the web url to specify the web of your source link. I clear this field because my source list is located in the root site of the root site collection. Ok.

Now select the source list in the next dropdown and the field of the source list which will be shown in the target list. In my case the source list is Countries and the field is Title. Ok.

By checking appropriate options you can enable multiple values for your lookup and add ‘New Item’ link which allows users to add new items to the source list directly from the form.

If you check Add ‘New Item’ link you will see the following options:

In the first field you can specify the title of the new item link. The second one is for default content type ID. When the user clicks the new item link they will see a form for the specified content type. If you leave this field empty, users will see a form for the default content type of the source list.

Here is what this link looks like in the form:

I will cover Advanced section fields in the next article. Now, let’s see what our lookup field looks like in forms and list views.

Lookup column with a single value:

Lookup column with multiple values:

List view:

Display form:

Looks perfect. In the next articles I will demonstrate how to change the template of the result set in the select box of Cross-site Lookup Column, how to use Lookup and Forms Designer together and create dependent columns and cascading dropdowns.

Recommend this: