Click here to Skip to main content
14,839,837 members
Articles / Productivity Apps and Services / Sharepoint
Technical Blog
Posted 10 Jul 2013

Tagged as

Stats

47.7K views
4 bookmarked

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

Rate me:
Please Sign up or sign in to vote.
4.43/5 (4 votes)
7 Aug 2013CPOL3 min read
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 the 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 site collection in the same web application and added a custom list to its root site 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.

SharePoint 2013 Cross-site Lookup

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.

Create cross-site lookup in SharePoint 2013

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.

Cross-site lookup column for SharePoint 2013 settings

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:

SharePoint 2013 lookup with add new item link option

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, she or he 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:

SharePoint 2013 lookup with add new item link

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:

SharePoint 2013 lookup with single value

Lookup column with multiple values:

SharePoint 2013 cross-site lookup with multiple values

List view:

SharePoint 2013 cross-site lookup in the list view

Display form:

SharePoint 2013 cross-site lookup in 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Dmitriy Kozlov
Technical Lead Plumsail
Russian Federation Russian Federation
Expert in SharePoint
The leader of SharePoint Forms Designer Team: http://spform.com
Co-founder of Plumsail: http://plumsail.com
My blog: http://formsdesigner.blogspot.com

Comments and Discussions

 
Questionazu Pin
damii24-Feb-14 3:58
Memberdamii24-Feb-14 3:58 
Questiontry it Pin
damii15-Oct-13 19:00
Memberdamii15-Oct-13 19:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.