Tuesday, May 6, 2008

Auto Number for InfoPath Forms in a SharePoint Library

After not finding a solution to this problem, I decided to try some things.

You might find this solution interesting. I was trying to get an auto number without using a DB connection. I have seen a few solutions, for example at http://www.infopathdev.com/forums/ where the number is generated by a SQL Server Table, but that seemed a little complex for me to build in a day.

Here’s what I did:

Create a secondary data source that points to the SharePoint list and pick the custom field which I named "PONumber"











Add it to the form using a text box. InfoPath complains, but ignore errors upon publishing it.






Create a workflow that sets the field value after submit. This also insures a unique value since it is using the ID of the list. This workflow is set to start when an item is created.

















The String Builder lets you put in the ID Variable of the SharePoint list.









And heres the final product. I haven’t thought of any reason why this won’t work well, except the number at the end, in this case, is the year. That will have to be manually changed in 09 and a new form library will need to be created of you want to start out in 09 with “ARL-1-09”.

Monday, January 28, 2008

InfoPath Form Library Security Configuration

In order to restrict access to users only being able to see their own records, that is, the records that they created:

1) They must not be able to create personal views (group permissions in SharePoint)

2) The library must not be searchable

3) The default view must be filtered on created by [me]

4) The other default views must be deleted in SharePoint Designer.


This also applies to any document library in MOSS 2007. I have found that this is the only option for my particular implementation since a Custom List in MOSS will not accept attachments from Safari on Mac OSX













Above is the default views that are created by the system. Below are the views that you should leave.












The next step is to remove the personal permissions for your users. They will not have the option to create or edit any views.

From the form library settings page, advanced settings section, choose "No" to "Allow items from this form library to appear in search results?"


Issues and Risks:

By destroying the existing views, which cannot be recreated (or at least not easily recreated) functionality will be lost, i.e. merging of forms, re-linking documents, and Explorer view.

Also, a savvy person could guess what the URL for a specific form is, and will have access to it since there is not any deny permissions in this library. I used a concat(Field X, "-", now()) to create a time stamp. That will make it very difficult to guess what the URL to the file is.