Unique ID in InfoPath Using SharePoint

06 January 2010 Categories: How To, InfoPath, SharePoint

Some solutions require a unique ID to be used for identifying forms saved in SharePoint or be used as a customer ID. There is a simple solution that does not use code, which is nice since many, many solutions these days are being generated with code. What some do not know is that so many tricks, solutions, and customized features are already built in, you just have to know how to get to them.

First, in SharePoint create your form library, we will call our UnitqueID. Then open InfoPath and create your form. Open the data connection wizard and create a connection to receive data. Next select that you wish to receive the data from a SharePoint List or Library and click next. Enter the URL to the form library, http://portal/UniqueID and select next.

IP-DCWiz1

IP-DCWiz2

After clicking next again you will need to select the columns you want to use. For this demo, we only need “ID” to be selected. Now go ahead and click next all the way through the wizard and hit finish.

IP-DCWiz3

Now you need to place a Text Field or Expression Box on your form and build a formula for the field.

IP-Prop1

Next to the Value input select the “fx” symbol to create a formula. You will need to type in max( and then select “Instert Group or Field and browse to the secondary data connection source and drop down until you find the ID and press ok.IP-Prop2

IP-Prop3

Finish the formula by adding )+1 so the whole formula should read max(@ID)+1. Press OK and OK again to close the properties of the field. Publish your form and open the form to test.

(Note: The library needs to have at least 1 item in the library in order for the ID to be generated. The first form will get a “null” response.)

  • TIP: Save an InfoPath Form in SharePoint
  • SharePoint Workflow – Part 1
  • Save with InfoPath and SharePoint
  • Fast Backup and Restore for SharePoint
  • Solve Item-Level Permission Performance Problems in SharePoint
    • Delicious
    • Facebook
    • Digg
    • Reddit
    • StumbleUpon
    • Twitter
    PHVsPjwvdWw+