Submitting Infopath to sharepoint - InfoPath Dev
in

InfoPath Dev

Submitting Infopath to sharepoint

Last post 01-03-2007 01:52 PM by Donald.Berg. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 11-23-2006 01:34 AM

    Submitting Infopath to sharepoint

    Help required...

    We have created an InfoPath form which is published in a document library on our SharePoint Site and what we are trying to achieve is to have a unique number that is automatically created when you save / Submit an InfoPath form. There are no Fields that could be used in the form. I would like to have the filename of my forms set to the unique number when submitted to a SharePoint Library.

    Can anyone help?

    P.s I am not a programmer so you would need to talk me through any code.

    Regards

    Michael.
  • 11-23-2006 02:11 AM In reply to

    Re: Submitting Infopath to sharepoint

    Hello michael.knowles welcome to the InfoPath forums.
    There is a GUID class in .net to create a Unique ID.
    System.Guid.NewGuid() method creates a new GUID for you.
    We use this for our form names to be unique.
    Take guid into a variable and save the variable as file name.

    Hope this helps you!






    Shilpa
    INFOPATHDEV India
  • 11-23-2006 05:39 AM In reply to

    Re: Submitting Infopath to sharepoint

    Please could you talk me through doing this?
  • 11-23-2006 05:46 AM In reply to

    Re: Submitting Infopath to sharepoint

    I have had a look at a GUID website. In need my file names to go up in numerical order 1,2,3,4,5,6, etc for the testing then they need to start at 300000 and go up...

    Any ideas?
  • 11-23-2006 08:40 PM In reply to

    Re: Submitting Infopath to sharepoint

    Hello Michael.knowles,
    If you want your guid increment 1,2,3..
    In onload event, take one value(1 or 30000 or etc..) into a variable and increment that value one or how much you want increment when new form(new solution is opening) is opened and save that variable as file name

    try this, hope this helps you!
    Shilpa
    INFOPATHDEV India
  • 11-24-2006 01:37 AM In reply to

    Re: Submitting Infopath to sharepoint

    Please could you talk me through this?

    regards

    Michael
  • 11-26-2006 11:15 AM In reply to

    Re: Submitting Infopath to sharepoint

    I'm relatively new to InfoPath, but there might be another way to do this that doesn't involve code. I haven't tried it myself, but in theory I think it should work.

    ) Add a numeric field to the data source on your form to hold your sequential number (call it formNumber for example).

    ) Make formNumber available as a form library column (Tools-->Form Options-->Form Library Columns)

    ) Publish the form to a form library on your SharePoint site, and expose the formNumber field as a column in your form library.

    ) Create a data connection on your form to receive data from your SharePoint form library. Select the formNumber as a field to include in the data received.

    ) Create a new dropdown or list box field and bind it to the formNumber field from the form library. Let's call this new field existingNumbers. It should show the list of all form numbers published to your form library.

    ) Edit the properties of the original formNumber field and set the default value to max(existingNumbers+1). This will now hold the next sequential number after the numbers already taken by the forms in your library.

    ) To include this number in the form's file name, you can use a function in the data connection you use to submit to the SharePoint library.

    I can't try this now because I'm not connected to my SharePoint server at work, but I think it will work (and might be easier for you if you are not familiar with code). Good luck!
  • 11-27-2006 01:13 AM In reply to

    Re: Submitting Infopath to sharepoint

    This almost works. It does not seem to put the max value from the drop down menu though?
  • 11-27-2006 06:30 AM In reply to

    Re: Submitting Infopath to sharepoint

    I'm not sure I totally understand the problem, but it sounds like you are trying to make the dropdown list display the max value? The dropdown itself doesn't need to display the max value, it just stores the list so you can grab the max value and use it to calculate the next number. You want to make the default value of your formNumber field equal to the max value stored in the dropdown list plus one.
  • 12-04-2006 02:41 PM In reply to

    Re: Submitting Infopath to sharepoint

    I'm having a similar issue. The value of max(existingNumbers)+1 does not seem to get updated until existingNumbers take a value - usually by user selecting an item from the list.
  • 01-03-2007 01:52 PM In reply to

    Re: Submitting Infopath to sharepoint

    I used the date to create a unique number that can be sorted by time also. Use this number as your file name when you save to the sharepoint library. Here is some code:

    [InfoPathEventHandler(EventType=InfoPathEventType.OnLoad)]
    public void OnLoad(DocReturnEvent e)
    {

    System.DateTime Requestdate = System.DateTime.Now;

    IXMLDOMNode RequestNumber = thisXDocument.DOM.selectSingleNode("//my:ServiceRequestForm/my:GROUP_ServiceRequestForm/my:FLD_RequestNumber");
    RequestNumber.nodeTypedValue = string.Format("{0:yyyyMMddhhmmss}", Requestdate.AddMilliseconds(1));
    }

    On your sharepoint library you can display as columns for the forms the ID number. These start from 1 and go up as forms are created. Then you can hide the filenames and use Type as links to the infopath documents from the form library.
Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.