SPFilterDropdown causing SharePoint error on item save

Oct 13, 2013 at 8:08 AM
I have a wish to filter a list item dropdown on a new/edit form using SPFilterDropdown, which I have been quite happily using for a while now. However what I am currently trying to do causes SharePoint to error out when saving the list item. What I am seeking to do is as follows:

I have a list which stores a record of staff training courses and the level to which each member of staff has been trained for any given course (e.g. train_ee_ or train_er_.) When creating a staff training record I need to be able to select a trainer from that training list, i.e. I am filtering a list of available trainers based on data stored in the list I am adding to. Now, from the UI point of view everything is working nicely as in my trainer drop down list I am successfully querying the correct subset of entries to display only the expected trainers, however after I select a trainer and click Save, SP errors out with the Correlation ID message.

As a simple test I removed the SPFilterDropdown call and relied on the OOTB column lookup functionality and this enabled me to select (albeit from an unfiltered list) and save successfully.

Below is my code snippet
      relationshipWebURL: "",
      relationshipList: "Employee Training Register",
      relationshipListColumn: "Employee_x0020_Name",
      relationshipListSortAscending: true,  // Added in 2013.01
      relationshipListSortColumn: "",
      columnName: "Primary Trainer",
      listName: $().SPServices.SPListNameFromUrl(),
      promptText: "",
      noneText: "(None)",
      CAMLQuery: "<And><And><And><And><Eq><FieldRef Name='Branch' /><Value Type='Lookup'>"+$branchVal+"</Value></Eq><Eq><FieldRef Name='Selected_x0020_Skill' /><Value Type='Lookup'>"+$selectedSkillVal+"</Value></Eq></And><Eq><FieldRef Name='Proficiency_x0020_Level' /><Value Type='Choice'>Trainer</Value></Eq></And><Eq><FieldRef Name='SkillExpired' /><Value Type='Choice'>No</Value></Eq></And><Eq><FieldRef Name='Training_x0020_Status' /><Value Type='Choice'>Completed</Value></Eq></And>",
      CAMLQueryOptions: "<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns></QueryOptions>",
      completefunc: null,
      debug: false
Now before someone says: "Use Powershell to interrogate the Correlation ID" I must point out that I am using SP Online and so do not (certainly as far a I know) have the ability to drill into the Correlation ID, and I also have little will power to raise a MS service call, so I am hoping that Marc or another will say that the SPFilterDropdown function is not designed to perform a query on its own list (although it does work, it compromises 'something' else where when the onSave event is fired - unlikely but you never know.

Also, given that the SPFilterDropdown call does filter, I'm certain its not going to be an issue with the function per se, but I have spent too many hours on trying to debug this and I'd be glad of another pair of eyes.
Oct 13, 2013 at 9:59 AM
Off to sit on the naughty step!

It's been said before, and I'm sure it'll be said again: Make sure you are referencing the right column correctly and make sure your test data is correct.
Marked as answer by fairfieldbusserv on 10/13/2013 at 2:59 AM
Jan 26, 2015 at 6:37 PM
I'm having the same issue but my lookup list is in another site (subsite). The form and filter works fine but when saving I get an error message.