Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to create a lookup field with the sharepoint ui which points to a field with a custom field type (parent field type is number). In visual studio with the object model this is not a problem but in the sharepoint ui i can't choos the field from the "in this column" drop down field.

Maybe someone can help

share|improve this question
add comment

1 Answer

Unfortunately, it is not possible to create lookup where you have a Custom Field Type as a target field.

Basic reflector exploration leads to the following code:

      if (field.Type == SPFieldType.Counter || field.Type == SPFieldType.Text || (field.Type == SPFieldType.Number || field.Type == SPFieldType.DateTime) || (field.Type == SPFieldType.Computed && ((SPFieldComputed) field).EnableLookup || field.Type == SPFieldType.Calculated && ((SPFieldCalculated) field).OutputType == SPFieldType.Text))
        // ...

Thus, you can use only the following field types as a target for a lookup field:

  1. Counter (usually ID field)
  2. Text (Single line of text)
  3. Number
  4. DateTime
  5. Computed (only if SPFieldComputed.EnableLookups is set to true)
  6. Calculated (only if it's Output type is equal to Text)

And even using the SharePoint object model, most likely, you will get an exception if you try to create Lookup field with target field of the "forbidden" type.

share|improve this answer
    
Mike Smith has a post that documents a workaround to this issue: techtrainingnotes.blogspot.co.uk/2012/01/… –  Stuart Pegg Jul 9 '12 at 11:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.