Thursday, March 29, 2012

How to manage Serial No. in form library in SharePoint

In SharePoint, form library is based on infopath form, when you submit the form in library, you have to required unique name or number. If you want that your form name is a sequence serial number then follow these steps.
  1. Add a field in your data source name as SNo.
  2. Create data connection to get Max value of ID from library, ID is a default value of any SharePoint library.
  3. Now add a rule of submit button and set field's value SNo = max(@ID) + 1.
  4. Remember, before set the value, you must retrieve the latest value of ID by using Query using a data connection.
  5. Here, one thing is very critical when you submit the form in library initially (means first time), you will get NaN value in ID. So, in this scenario, Point No. 3 will not work properly.
  6. To avoid this kind of issue, please follow the below steps.
  7. Open properties box of SNo. then goto Rules and Merge Tab.
  8. Then Add Rule, Set Condition and Set value.
    • Rule name can anything that you want.
    • Set Condition should be SNo = NaN.
    • Set Value should be SNo = 1.
  9. Now create data connection for submit the form and assign SNo in file name field.
  10. Good Luck guys :))) 

      No comments:

      Post a Comment