How are list lookups with crosssitelookup stored?

Feb 28, 2010 at 10:19 PM

Disclaimer: I am new to SharePoint, CAML and SharePoint. I just took a look at http://www.sharejpoint.com/examples/Lists/CrossSiteLookupDemo/NewForm.aspx

and I have a few questions (so far) from the demo.

1. The edit form didn't have the same list lookup functionality. Is that only because the needed jParts weren't enabled on the default EditForm/DispForm .aspx files?

2. When you go to view or edit an item, you see the actual region text saved but not a lookup ID so this wouldn't work on a list with a lookup column then?

3. I am wondering if it wouldn't work with actual lookup columnsGoing through the crosssitelookup.js I see the CAML where clause being built up using the text value of the lookup field as opposed to retrieving an ID. I do see the item ID being passed back in the response but, if I understand the script correctly, the dropdown list items are set in the picklist loop at line 63 where both the text and the value are set to the value of the LookupFieldName. If that were set to the ID instead of the text value, would that be usable on a list with a lookup column then?

4. Are there other jPoint helper functions

The main reason for asking of course if the text of the lookup changes I would want it to all update correctly and to help make sure I do understand what I am seeing. This is a very helpful project indeed!

Michael

Coordinator
Mar 1, 2010 at 2:10 PM

Hi Michael,

Ken might be able to elaborate better on this issue, but you are on the right track.

The reason we have created crossSiteLookup the way we did was flexibility of saving any data to a lookup field.

Out of box sharepoint works on a principle that it will save data only if it has pre-created option in a lookup list.

Converting text to dropdown has lots of flexibility.

Mainly I can quickly set my dropdown from any list on my site and use it as lookup.

Also I can query 3rd party webservice and use that data to create lookup dropdown in my sharepoint list.

I can create cascading dropdowns by adding onchange event to the one dropdown and populate second dropdown.

I would just have to apply crosssitelookup to both newform and edit form. (In disp form it shows up as text field).

Also if underlying lookup list changes my data is not affected by it.

Mar 1, 2010 at 4:11 PM

That totally makes sense and I can see a use case for NOT wanting a lookup ID especially if the external data can change in unwanted ways.

Many thanks,

Michael