3

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

1 Answer 1

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")
3
  • 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
    Commented Sep 9, 2011 at 2:05
  • Also, how do I reset the ID when a new year approach?
    – Wilson Tan
    Commented Sep 9, 2011 at 2:07
  • I've done until step 13.. on step 14 I couldn't find Rule. I'm using SharePoint 2013. Please guide.
    – Yuges
    Commented Jan 7, 2016 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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