Friday, August 7, 2015

Auto-numbering InfoPath forms for large SharePoint form library

Recently i observed one issue- users were not able to create tickets on form libraries which having many items or say libraries crossed threshold limit.

Some form libraries used max(@ID) + 1  logic to get last item ID for ticket creation and some used XML Connection using SharePoint View. Both the options doesn't work for form libraries which having many items.

Best solution to overcome this issue is, use REST connection to get last item ID. Use below REST URL format

http://sitecollection/site/_vti_bin/ListData.svc/LibraryName()?$top=1&$orderby=Id%20desc&$select=Id

Ex.

http://contoso/sites/Systems/_vti_bin/ListData.svc/Tickets()?$top=1&$orderby=Id%20desc&$select=Id