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
relationshipList: "Employee Training Register",
relationshipListSortAscending: true, // Added in 2013.01
columnName: "Primary Trainer",
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>",
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
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.
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.
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.