Unique ID for InfoPath form to SharePoint - InfoPath Dev
in

InfoPath Dev

Unique ID for InfoPath form to SharePoint

Last post 03-21-2013 11:05 AM by Hilary Stoupa. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-15-2010 09:49 AM

    Unique ID for InfoPath form to SharePoint

    Hello,

    I'm looking for a way to create a unique ID for each form submitted to a form library.  Is there a way to accomplish this without any new downloads?

    I use a combination of fields on the form and the date to create a name for the submitted form.  An issue arises when someone tries to submit two forms with similar data on the same day which happens a lot.  Currently we're working around the issue by manually changing the name of the previous submission so the new submission doesn't overwrite the previous submission.

    Thanks,
    Roger

  • 03-15-2010 11:25 AM In reply to

    Re: Unique ID for InfoPath form to SharePoint

    Hi Roger,

    If you use the now() function to get the current date/time you will get the time down to a 100th of a second.  If you concactenate the user ID along with now() as the unique ID you should be fine as the odds that someone saves the form with the same user name at the exact same 100th of a second is pretty small.

    SharePoint also does have a unique ID that gets created when you create a new document.  If you query the SharePoint GetListItems web method you can get that ID back and insert it into the form, this is a unique number but it only gets generated when you save the form the first time so you have to save the form once, query for the ID and then save that in the form and save again.  Agni has a good blogpost here: http://www.infopathdev.com/blogs/agni/archive/2006/05/15/Query-for-Items-in-SharePoint-Form-Library-Using-GetListItems-Web-Method.aspx

    Hope that helps

    Ted

  • 03-15-2010 03:21 PM In reply to

    Re: Unique ID for InfoPath form to SharePoint

    Wow. Don't I feel foolish. The now() function will work just fine. I already had the date concactenated with the sales ID. Not sure how I overlooked that function. Thanks!
  • 03-21-2013 10:55 AM In reply to

    • AlexK
    • Top 200 Contributor
    • Joined on 12-31-2012
    • Posts 61

    Re: Unique ID for InfoPath form to SharePoint

    If you use the "now" route, won't there be an issue when editing forms? For example, go back into the submitted form and change some fields, then click Submit again. Instead of overwriting the existing form like it should (an update), a new form will be created because "now" causes the form to have a new title. How to get around this?
  • 03-21-2013 11:05 AM In reply to

    Re: Unique ID for InfoPath form to SharePoint

     If you use now() in a formula to create the form name, yes, that will happen. I usually add a field to the form for the form name, and add a form load rule to set it with the condition that the field is currently blank. Then now() will be when the form is first created, and stays stable.

    Edited for clarity: I mean, if you use now() in a formula in the data connection wizard. :)

    Hilary Stoupa

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.