Ever had the need to map a Choice Field to a drop down list in InfoPath?
SharePoint REST API makes this super easy! gone are the days of Lookup Lists and Lookup Columns. No need to maintain two sets of values either!
A rather unknown feature of SharePoint 2010 onwards is the fact that the REST interface, the one you access via /_vti_bin/listdata.svc, also gives you access to your choice fields in a simple XML format. Effectively the new choice field becomes a new entity at the same level as the list/library with a concatenated name.
So if you list is called Customers and the choice field is called Region, the url would look as such:
SharePoint will spit a RSS formatted feed back out at you with all the choices listed :-)
All you need to do now is go to your InfoPath form, create a new data source, select REST Web Service as the source and paste the url to the choice list. Press OK and Finish, and now you can use that data source for your drop down values by:
- Modifying the Drop Down List Box Properties
- Choose Get values from an external data source
- Pick the REST data source
- For Entries source pick /ns1:feed/ns1:entry
- For Value and Display Name pick ns1:title
This post first appeared on SharePoint Training, Alex Dean, please read the originial post: here