I have been struggling to generate unique (not random) number for Infopath field and searched across all the blogs. Everyone has their own way of doing it, someone suggests to append number to the item ID and concat date and time etc. If i take this approach, there are several issues, if concurrent users opens the form at the same time, it throws all weird errors.
Thanks to my old good friend and these guys who has pointed me to the right direction in achieving what I need. They have done an excellent test and analysis on “Unique random” numbers using RNGCryptoServiceProvider.
I would simply provide links to their blog rather than re-writing everything here.
Below is the code for your to simply copy and paste it in your infopath code editor. But remember to replace “/my:myFields/my:po_number” with your field name. Also you can append “ITPO” with anything you like. Continue reading