locked
How to Create Auto increment Request number for browser enable infopath form field Programmatically? RRS feed

  • Question

  • hi all,

    i have created an infopath which have one request no. field and it will auto increment when click on add new item on sharepoint Document library

    field contains (highest value of column request no. +1 )  when infopath will open in browser.

    What i have done on this:i have create new data connection on sharepoint library and then pick document library then choose ID field and insert function in the field max(ID)+1.

    help me

    thanks

    shubham
    Monday, January 17, 2011 10:42 AM

Answers

  • By just doing it.  Change the data connection locations.  Go publish the form to the new location, and at the end of the publishing wizard, it should ask you if you want it to update the data connections for you.  Check that box.

    If for some reason you aren't getting that option, then you need to actually open your data connections while in InfoPath and change the URLs.  I don't know what else you need to know.  If you built the data connections the first time, then you should know how to modify those same data connections.  What happened when you tried?


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Lily Wu Sunday, January 30, 2011 2:28 PM
    Wednesday, January 19, 2011 7:33 AM

All replies

  • what you expect if one user open this form, not submit it, and second user open this form too? it will be two different id's?

    what you expect if user open form but then cancel it? id must be registred?

    may be id must be registered not when user creates form, but when submit it?

    Monday, January 17, 2011 10:54 AM
  • Hi.Thanks for your reply, let me more elaborate it,

    in a document library I am creating Request tracker , so whenever user clicks on Add document to create new request, InfoPath form opens up, this form has Request Id field which is supposed to be auto generated and auto incremented.

    so when second user clicks on Add Document " InfoPath form opens with next request number.

     

    Monday, January 17, 2011 11:01 AM
  • what you expect if user open form but then cancel it, go away? id must be losed and next user will get next id?

    Monday, January 17, 2011 11:09 AM
  • nothing

    if any user open the form and click cancel,  the same ID will generate on next click(add document).

    nothing to do on cancel button simple the form will close and return to sharepoint site.

    Monday, January 17, 2011 11:17 AM
  • User A clicks on Add document, form getting new Request Id. User B clicks on Add document, form getting next Id. User A clicks back or close in their browser, so id is losed. This is not catastrophic, but I suppose to look at 2 patterns to this business (not technical) task:

    1. id getting only after submitting the form (recomended)

    2. id getting on specific time to be submitted (for example, 15 minutes). If after this time id is not submitted, id is expired and available again.

    Monday, January 17, 2011 11:54 AM
  • hi Alexander,

    thanks for reply

    i have to create an infopath request no. when any body click on Add document.the infopath is used by single person which is administrator.so there is no User A or B.

     

    thanks


    Tuesday, January 18, 2011 6:33 AM
  • Why does the ID have to be generated the moment the form is opened?  It only makes sense to create the ID the moment the document is created.  SharePOint automatically assigns an auto-incrementing sequential ID, so why do you want to create a 2nd one?  If you do this, then you're introducing potential problems, but if you use the built-in ID, it can never be wrong, and it can never have conflicts.  If you need to create a custom alphanumeric ID for the form, then all you need to do is configure your submit button to first submit, then retrieve the ID back from the form library, and concatenate that ID with your custom pattern.  This makes much more sense, is very easy, does not require code, and can never be wrong.

    If this isn't sufficient, then here is my article showing the method you're asking, but which I disagree with:

    InfoPath – Auto-Numbering Forms


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force

    Tuesday, January 18, 2011 7:13 AM
  • thanks for your reply,

    I implemented this on my local server and it is working fine, however when i use the same form on my production server which is in different domain and physically located somewhere else,  it is giving me  error , because on production it is searching the l local server's library.

    how can I implment the same thing relative to the server, another point is production server do not have infopath , it is running just infoPath services.

     

    Tuesday, January 18, 2011 10:58 AM
  • You have to change it in production.  Fix the data connections.  Servers don't need InfoPath.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Tuesday, January 18, 2011 7:29 PM
  • hi, Thanks Again,

    Could you please help me to understand how can i update data connection on server without infopath?

     

    Wednesday, January 19, 2011 7:03 AM
  • hi, Thanks Again, Could you please help me to understand how can i update data connection on server without infopath? 

    I don't know what you mean.  You edit the form and the data connections with the same machine where you built the form  initially (using InfoPath)InfoPath you used to create the form.  You don't do any development on servers - you do it from whatever client you use to do development.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Wednesday, January 19, 2011 7:22 AM
  • yes thats what i mean.

    For example my Development server is http://Serverabc which is in domain xyz. now I have developed infoPath on this server and dataConnections is used of this Development server.

     

    Now I am deploying my form to Production which has another domain PQRS, and Server url is different , My form built on Dev server is not working on production , because it is searching for the url of development server as per data Connection.

    so my query  is how can I provide this new(Production) dataconnetion to my form so it  can run on production server with Production URL.

    thanks again

    Wednesday, January 19, 2011 7:28 AM
  • By just doing it.  Change the data connection locations.  Go publish the form to the new location, and at the end of the publishing wizard, it should ask you if you want it to update the data connections for you.  Check that box.

    If for some reason you aren't getting that option, then you need to actually open your data connections while in InfoPath and change the URLs.  I don't know what else you need to know.  If you built the data connections the first time, then you should know how to modify those same data connections.  What happened when you tried?


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Lily Wu Sunday, January 30, 2011 2:28 PM
    Wednesday, January 19, 2011 7:33 AM
  • interesting, the question in the orginal title seems to have info what I need, and the question is answered, but not related to the ID. I am looking for using the ID as document name when saved to sharepoint.

    I know sharepoint each time give a autoincrement id for a form saved, but how to use it as a name saved instead of user enter their own name(they could submit same thing in different names after edit)

    Thursday, April 14, 2011 2:20 PM