Auto-Generated file name - InfoPath Dev
in

InfoPath Dev

Maintenance notice: We may have service interruptions tonight, 5/22/2017, between 8 & 9 pm PST.

Office365 Alert - Sandbox has been deprecated in SharePoint Online.
Read more here.

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Auto-Generated file name

Last post 01-28-2008 03:39 PM by eeyore145. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 01-17-2008 02:06 AM

    Auto-Generated file name

    Hi all,

    how to generate a file name automatically??

    my case in details:-

    I design form-template in InfoPath and publish it to FormsServer (a service in SharePoint) and then i have a XmlFormView control in my ASPX page which renders an instance of the template already designed and published, the user in my application then fill out this form and then he can submit it (use the submit button that comes with the form toolbar) or save it (use the save or save as button).. after submitting or saving the form a pop-up appears prompting the user for the FILE NAME, and then the form will be saved back in FormsServer under the name "FILE NAME". the problem here is that i dont have access to the FILE NAME coz it's the last step before saving the form, plus the pop-up prompting user for FILE NAME is created by the FormServer so i dont have access to it!

    what i'm looking for is to have the form in my ASPX page with a SUBMIT button only (without save, save as, update, ...etc) and when a user click on that submit button a FILE NAME is generated automatically without prompting user to enter a FILE NAME. can i have this done?? is it InfoPath responsible for creating an Auto-Generated name by using rules or other feature?? is it FormsServer responsible for craeting an auto-generated name?? what other options i can have to generat such a FILE NAME???

    note that i dont have VSTA, but if it is needed (required) to achieve this goal, plz tell me!

    thanks.

    Osama Momani

  • 01-17-2008 07:00 AM In reply to

    Re: Auto-Generated file name

    In form options you can turn off the save / save as functionality, typically a good practice.

    When you create the data connection to submit to SharePoint use the concat function and fields from your form to create a unique file name for each document.

    Maybe name date and ID, or just ID or whatever.

    That way they hit submit, you know ecatly where the form is saved and by what name, and they do not get anymore prompts.

  • 01-17-2008 09:29 AM In reply to

    Re: Auto-Generated file name

    Thanks for ur reply :)

    ok, its a good way i have already applied it, but i have one more question,  for my application, users are able to design a  form and publish it to forms server, and plus they will fill the forms displayed on web browser, they have much interference to the system....

    i'm asking for a way to get the file name of that form before submitting it to forms server, even if its name is not auto-generated!! is there an event i can catch so that i can get the file name that a user typed while submitting?? is there a way to have that name programatically to save it in DB, and then i can know that this form is for this user????

    i need ur help in that, plz provide me with some tips!!

    thanks alot

    Osama Momani

     

  • 01-17-2008 09:47 AM In reply to

    Re: Auto-Generated file name

    So you want to know the filename of an existing form that is being opened by the user?

    There is a way to get this in code I know.

    Or are you wanting to identify the user and then use that in your form for certain permissions.

    You also may be talking about promoting the username field. Then you could create a sharepoint view of the library where users only see there forms.

    Please clarify your process and what you are trying to accomplish.

  • 01-17-2008 10:04 AM In reply to

    Re: Auto-Generated file name

     

    to get the file name of an existing form would be so much helpful!!!!!

    the complete scenario:-

    user A opened my application, now he got a New instance (new instance means: that it still doesnt have a filename) of a given form-template (lets say STATUS REPORT), he is filling it out, finshed, now its time to submit the form to FormsServer. the user A will give that instance a filename (e.g. FORMNAME). once he clicks save, the form will be saved in a document library in FormsServer under the name FORMNAME, right?? here i want to retrieve the filename of this form so that i can save in my DB that user A filled out the Form FORMNAME. i cant expect what that user typed in the filename field before submitting so i want a way to retrieve what he typed??

    hope this clarifies the case!

    thanks

     

  • 01-17-2008 10:12 AM In reply to

    Re: Auto-Generated file name

    Typically you would not give the user the opportunity to name the form themselves. having a standard naming scheme is much better.

     Best practice is you create a submit data connection, which submits to the SharePoint Library. You create the form name from fields within the form. Concat(Name, "-", Date, "-", ID) or something like that.  Then you have unique names in your library and they are all standardized and easy to browse.  Also then you can harvest the name from your form before you save it since you know what the format is.  You can then pass this back to the calling program.  If you wanted them to have the ability to custom name ahave them put it into a field in the form and then use that for the form name and also to access from your calling program.

  • 01-17-2008 10:47 AM In reply to

    Re: Auto-Generated file name

    the problem is that, i wont navigate the library, i want to save that name in DB so that when this user log in again i can select his file name from my DB and render it back in the browser by editing XmlLocation property of XmlFormView programatically! can u help in this?? hopefully it is clear now for u!!

    plus, can u provide me with the code of retrieving filenmae of an existing form in form server!!?\

     

    many many thanks :)

    Osama Momani

  • 01-23-2008 06:41 PM In reply to

    Re: Auto-Generated file name

    Hi Clay, RE: Concat(Name, "-", Date, "-", ID) -- I have everything up to ID ... I'm struggling how to create a random number to populate the ID field only ONCE (when the form is initially created, not every time a user opens the form from SharePoint). Any thoughts? Thanks, Tom
    Clay Fox:

    Typically you would not give the user the opportunity to name the form themselves. having a standard naming scheme is much better.

     Best practice is you create a submit data connection, which submits to the SharePoint Library. You create the form name from fields within the form. Concat(Name, "-", Date, "-", ID) or something like that.  Then you have unique names in your library and they are all standardized and easy to browse.  Also then you can harvest the name from your form before you save it since you know what the format is.  You can then pass this back to the calling program.  If you wanted them to have the ability to custom name ahave them put it into a field in the form and then use that for the form name and also to access from your calling program.

  • 01-23-2008 06:59 PM In reply to

    Re: Auto-Generated file name

    Calculate the ID but store it in your form and reuse it each time.

    Since you are using SharePoint you can also create a data connection to the library and search for the max number or find the file already and validate the name is the same.

    Probably the best thing is to not create the file name in the data connection but in your form and save it in a field. Then you can reuse and preserve that field for th elife of the form. As long as overwrite is turned on in your library then you can overwrite or update the file without creating a new one.

  • 01-25-2008 11:36 AM In reply to

    • KoopLaFez
    • Not Ranked
      Male
    • Joined on 01-22-2008
    • San Diego, CA
    • Posts 21

    Re: Auto-Generated file name

    Clay Fox:

    So you want to know the filename of an existing form that is being opened by the user?

    There is a way to get this in code I know.

     Do you know what the code is for retrieving the name of an existing form?  I'm fairly new to this so I've been looking at the XDocument object in the help file because that's pretty much all I know, but I've been unable to find the form name there.  Is this something that's stored in an object property, or am I barking up the wrong tree?

  • 01-25-2008 12:08 PM In reply to

    Re: Auto-Generated file name

    You would need to go through the reference or do some searching.  I am pretty sure there is a property to return file name.  I think I have seen posts on it before.

  • 01-28-2008 03:39 PM In reply to

    Re: Auto-Generated file name

    Are you posting this form to a form library in MOSS for example?  If so, you don't need a line of code to get the existing name.

     1) Create a new receive data connection

     2) Choose the SharePoint library in question - - where it has been published and where documents/forms are being saved

    3) Select the fields to bring in, for example if you choose ID and Title you can the default ID of the that list item and the title, such as "12345.xml"

    4) Now bind your receive data connection fields to some fields on your form, which could be hidden fields or viewable fields, depends on what you need to do.

    5) You could have conditional logic/rules when a form is "new" or not saved.  if IsNew, there is no title or id for this list item.  Therefore on save or submit create a new name by concating fields together, like already mentioned, store the state in a hidden text field on the form.  If NOT IsNew, call the receive data connection, and populate your "name" field with the title or id of this item, done.

     

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