Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

May I know how do I use a InfoPath form text field to auto generate a custom format ID?

The custom format ID must be in this format: YYYY/XXXREQ

where YYYY is the year that the item is created, follow by a '/', follow by XXX (a auto-increment value) and REQ is the suffix

Example: When the first item is created on year 2011, it will have the ID 2011/001REQ

So, when the last item created on the same year, assuming it is the 345th item, it will therefore have the ID 2011/345REQ.

As a new year approach, year 2012, the first item created in 2012 will have the ID 2012/001REQ

share|improve this question

1 Answer 1

Add the following nodes on InfoPath with its corresponding formula as default values.
Make sure Update this value when the result of the formula is recalculated field is selected on all of them.

Read Auto-numbering InfoPath forms when they are submitted to a SharePoint form library

nextID = max(@ID) + 1

paddedNextID = concat("000", nextID)
length = string-length(paddedNextID)
startposition = number(length) - 3
properNextID = substring(paddedNextID, startposition + 1, 3)
customID = concat(substring-before(today(), "-"), "/", properNextID, "REQ")
share|improve this answer
    
Do I paste the above code to the step 10 of the article : bizsupportonline.net/browserforms/…? (I tried that and it say that the formula contains one or more errors.) –  Wilson Tan Sep 9 '11 at 2:05
    
Also, how do I reset the ID when a new year approach? –  Wilson Tan Sep 9 '11 at 2:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.