I seemed to have broken something fundamental. When I edit a SharePoint InfoPath form List Item, it submits an entirely new list! How can I make my Submit button perform the "old" way and just "save" the data to the same item?
Follow the below steps to make your file name unique when you edit and save
- Step 1 – Create a Hidden Field
- Step 2 - Add a Submit data connection
- Step 3 - Add Custom Rules to Submit action
Step 1 – Create a Hidden Field
A hidden field is a field that exists in the data source of the form but is not visible to the user.
The easiest way to create a hidden field is to drag-and-drop a text box control onto the form template’s view. Rename the text box to ‘filename’ and click OK. Then select the filename text box and hit delete to remove the field from the view.
Step 2 – Add a Submit Data Connection
Go to Tools, Data Connections and click Add. Create a new Connection to Submit data to a SharePoint document library:
Enter the document library, and click the fx button and Insert the field ‘fileName’ in order to give the form submitted the name stored under ‘fileName’. Select ‘Allow overwrite if file exists’.
Give the data connection a name:
Step 3 – Add Custom Rules to Submit Action
Go to Tools, Submit Options, and click on Rules.
Add two rules as follows:
Rule 1 (fileNameBlank):
Set condition: filename is blank:
Set Action 1: Set field’s value filename = concat (Myfield, now()):
Use field on the form i.e., contactName, followed by the function now() to add the date & time and give the form a unique name.
- Set Action 2: Submit using a data connection (the one created in Step 2):
- Rule 2 (fileNamenotBlank):
- Set Condition: filename is not blank:
- Set Action: Submit using a data connection (the one created in Step 2):
You should now have the following 2 rules setup for Submitting Forms: