November 24, 2010 9 Comments
A coworker recently sent out an email asking if anybody had any ideas about enforcing a composite key relationship in SharePoint 2010 without writing code. On our current respective projects, we are both tasked with providing solutions that show off SharePoint’s no-code capabilities. Because of this, I have found myself using InfoPath more and more. When I saw this email, I thought “I bet InfoPath can do this!”
To better explain the composite key relationship I am looking for, I would like the ability for SharePoint to enforce uniqueness on a combination of two fields. These two fields, when used together, are able to uniquely identify any item in this list. Unfortunately, SharePoint doesn’t support this out of the box.
So with that, off I went to InfoPath to put a sample together. It turned out to be even easier than expected. Albeit, a bit more contrived than I would like it to be (supported from SharePoint’s list settings page.)
The sample I put together was a simple reservation system. Let’s assume that for obvious reasons, the business want’s to restrict reservations such that a product can only be reserved once a day. One list contains information related to products. Another list contains reservation information, including a product and a reservation date.
Here are the two lists I set up: Read more of this post