Sunday, July 8, 2012

Creating Unique ID for Sharepoint Infopath Form

Referred URL

http://social.msdn.microsoft.com/Forums/nl-NL/sharepointinfopath/thread/a68b1129-deb3-41a9-a077-c3e8fc3ef86a 

http://www.codeproject.com/Articles/37093/Submitting-an-InfoPath-Form-to-SharePoint-with-a-U

This Article shows how to create a unique ID on Sharepoint Infopath Form 

The Now() function will return the following type of date and time format: 2008-05-30T15:12:20

The function will come up with Ch1108288710.  A long number but it is a reliable sequence of number for the next 99 years. 

image010.jpg

Set condition: filename is blank:

image012.jpg

Set Action 1: Set field’s value filename = concat (Myfield, now()):

Use field on the form i.e., contactName, followed by the function now() to add the date & time and give the form a unique name.

image013.jpg

You can also rely on the exact date and time.

concat(substring(., 1, 2), concat(substring(now(), 3, 2), substring-before(substring-after(today(), "-"), "-"), substring-after(substring-after(today(), "-"), "-")), normalize-space(string(number(substring(now(), 12, 2)) * 3600 + number(substring(now(), 15, 2)) * 60 + number(substring(now(), 18, 2)) * 1)))

No comments: