1
votes

I created an app for SharePoint 2013 (HTML/JS). This app contains 2 lists:

  • Leave Requests
  • Leave Types

"Leave Requests" list has a lookup field that gets the values from "Leave Types" list.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
  <Field
       ID="{f3fca7f2-7232-4d5a-ba45-e6f5417fbc73}"
       Name="LeaveType"
       DisplayName="Leave Type"
       Type="Lookup"
       List="Lists/LeaveType"
       ShowField="Description"
       Required="TRUE"
       Group="Leave App Columns">
  </Field>
</Elements>

I also added the items for "Leave Types" (I can see the items when opening the table). However, if I try to create a new item on "Leave Requests" list, the Leave Type field has an empty dropdown box. What am I missing? Why is the dropdown box empty?

4
I can see that you lookup field is Description. Could you please check that this field is not empty in items in your Leave Types lists?Yevgeniy.Chernobrivets
@Yevgeniy The "Lists/LeaveType" contain items and the column "Description" is populated. I also tried "Title" and it's still not working. Any other suggestions?Richard H

4 Answers

2
votes

I tried to follow the steps in the link below...

http://www.sharepointnutsandbolts.com/2012/08/create-lists-content-types-files-etc.html

...but the dropdown was still empty. I believe I had renamed a few fields and the old names were still referenced somewhere in the XML files. I deleted and recreated the lists, then everything worked as expected.

1
votes

The same issue happened many other times. The solution was to remove the \FEATURES\Feature??? that contains the LIST that is causing the problem. Then go to the another FEATURE??? and add the list to that feature.

0
votes

Ensure that the list Leave Type already exists when the feature for the Leave Requests is activated.

For a SharePoint App context, start by adding the leaveType then add the leaveRequests.

0
votes

...but the dropdown was still empty. I believe I had renamed a few fields and the old names were still referenced somewhere in the XML files. I deleted and recreated the lists, then everything worked as expected.

When you changing properties of Site Column (Elements.xml file) the column properties in List's Schema will not get updates automatically. But, if remove column (or Content type witch contain the column) from List and than add it again, list will get all updated properties from Site Column's Elements.xml file.

After feature deploying the List's columns will be with updated column properties.

Update after additional checks:

If type of Site Column in the beginning was different from 'Lookup' or 'LookupMulti', then Site Column must be recreated with a new Name and StaticName properties value ( for example [prev-name]2" ).

<Field
       ID="{7FFA9DE3-C0AA-4E0A-ADD9-2E129CC40023}"
       Name="Questions2"
       StaticName='Questions2'
       DisplayName="Questions"
       Type="LookupMulti"
       Mult="TRUE"
       List="Lists/QuestionsList"
       ShowField="Title"
       Required="TRUE"
       Group="Questions Columns">
  </Field>

Tested on SharePoint Hosted App.