Infopath 2010 : Maintain a form name

When you submit an Infopath form you need to choose a filename often calculated to be sure is unique. When you submit a form which already exists you need to know the file name to resubmit with the correct name. With Infopath there is no way to know the name of the current form.

To bypass this disadvantage, I use a hidden field named “filename” which will contain the name of the file. I set this field value at the first submit and reuse it for all following submit.

For this example, the field is visible but usually I hide it.

I add a new data connection to the list where I submit the form and set the file name to the value of my field Filename.

In submit option, I choose to perform some action rules on submit.

And I setup the following action rules: First I look at Filename field value, if it’s blank I set it to a new value “My file”. Next, I submit the form with the data connection created just before.

I publish my form to the SharePoint Server.

Set the server name.

Publish as a site content type.

Create or update a content type.

Choose a form library where my form template will be uploaded.

Add some fields which will be added to the site content type.

I add the Filename to make it available on the list.

And I publish my form.

On the SharePoint list settings where the forms will be submit I add a new content type.

I add the content type created previously in Infopath.

On Sharepoint Designer I add a new workflow on the list to maintain Filename field.

The workflow is to set Filename to the name of the file.

I check to start the workflow when an item is created or changed to maintain the Filename on each event.

Now, when you resubmit a form you replace the preceding version because you use the same name. And when you renamed it and resubmit it, the Filename field is update and you replace the old version too.