Creating cross-site lookup field in SharePoint
Cross-site lookup field is something we need almost every project that is not very small. There is no good OOTB solution but we can use field by Toby Bierman. This kind of field is easy to create because SPFieldLookup is cross-site by its nature. Basically you ave to perform the following steps.
- Create custom field that extends SPFieldLookup.
- Create editor control for this form. This form may look exactly like Lookup fields one but you have to add dropdown for site selection.
- Write logic for filling dropdowns when something is selected from webs or lists dropdown.
- Override field saving method and assign value to LookupWebId property of lookup field.
LookupWebId property is already there but SharePoint doesn’t show us it through user interface.
Although it may seem to be convenient to use and extend SharePoint’s own lookup field UI control you shouldn’t do it – it is currently for internal use only and if something changes then you nobody warns you. LookupWebId property is public property and when something changes then users should be warned before.
How to update lookupwebid? The lookupwebid won’t allow me to update if the web id is another site collection.
Please let me know this is urgent.
You can not set it only if it is null. So you can assign it value only once. After that this field must live with this LookupWebId until it is deleted.
Hi I know a way to create the cross site lookup OOTB. I will be the sharing the URL shortly to demonstrate the solution