InfoPath “Save Draft” Form Functionality – A Better Way
There are a couple of buttons in InfoPath forms by default called “Save” and “Save As”. I never ever (ever) like to use these, and immediately disable them. I don’t like these buttons because it gives the end users the freedom to save the form with any filename at all, which can make a big mess of a form library.
This solution can be done in any version of SharePoint or SharePoint Online with Office 365.
So when I tell people that I always disable these buttons, people’s response is “Wait, but what if we need to give users the ability to save a draft of the form before they submit it?” My answer is to still use the submit functionality only, and put buttons on the form for “Save” and “Submit”.
The tricky part of this solution, is the fact that a form will inevitably have a few required fields, but they’re not supposed to be required if it’s only a draft. In this post I’ll show you how to accomplish this. When users fill out a form, they will have a “save draft” button and a “submit” button, and users will not get an error when a draft is saved and required fields are not filled out.
In this example, I’m going to use a super simple form, with just a few fields. There are four text fields, called FirstName, LastName, FormName, and FormStatus.
- For the FormName, the default value is translate(now(), “:-T”, “”)
Be sure to uncheck the box “Refresh value when formula is recalculated”. This is the typical method I use for InfoPath file names. Each filename will be unique, and it won’t be dependent on any particular fields being filled out.
- Go ahead and publish this form to SharePoint. I usually do this before creating the data connection for submitting.
(Note for beginners: For a full tutorial, screenshots and details about publishing and submitting forms, you can read chapter 6 in my book)
- In the browser, go to the form library you created when you published the form to SharePoint. In the address bar, copy the URL to the clipboard.
- In the Data tab in your form, click To SharePoint Library.
- In the Document Library box, paste the URL to your new form library, the one you copied at step 3. Remove the /Forms/AllItems. For the file name, use the function button to select the FormName field in your form. Check the box to allow overwrite if file exists.
- Click Next. Click Finish.
- This form is very simple, and has first name and last name text boxes. Place two new buttons at the bottom of the form.
- Select the SECOND button, and click the Properties tab in the ribbon. In the Action drop-down, choose Submit.
- Click the Submit Actions button. Select Perform custom action using rules. Click OK.
- In the Rules pane on the right, click the Add button, and choose Set a Field’s Value.
- For the field, select FormStatus, and for the value, just type the word Submitted. Click OK.
- Move this rule up above the “Submit” rule that was already there.
- Click to select the first of the two buttons on the form, the one that still says “Button”. If you don’t already see the Rules pane on the right, go to the Home tab, and click Manage Rules.
- Create a new Action rule that will have 3 actions: Set a field’s value, Submit, then Close. Note that if you’re not sure how to set a field’s value, refer back to step 11.
- With the button still selected, click the Properties tab in the ribbon. For the Label, type Save as Draft.
- Just so that you can see the value of the form status, go ahead and drag the form status field onto the form. Right click the field, choose Change Control, and choose Calculated Value. This is a quick way of putting a read only field on the form.
- Open the properties of the FormStatus field, and set the default value as New.
- On the Data tab, click the Form Load button. Create a new Action rule. Name this rule Draft.
- Click the blue text under the word Condition. The condition is Form Status is equal to Draft. Click OK.
- Click the Add button, and create an action to set a field’s value. Set the Form Status value to New.
- Now it’s time for the meat of how this solution works. Click to select the First Name text box. This is where we create a rule so that this field is not required if the form is in draft state. In the Rules pane, click to create a new Validation rule. You can call it “required”.
- Create the following as the conditions:
- Type some text in the screen tip box:
- Click the Copy icon at the top of the Rules pane (it’s the first of the 4 little icons at the top).
- In the form, click to select the Last Name text box on the form. In the rules pane, click the Paste icon. Notice that the rule was smart enough to alter itself to the new field’s name.
- Now it’s time to get rid of the Save and Save As buttons. Click File, click Form Options, and uncheck the Save and the Save As options. Click OK.
- One more thing. You may want the “Save as Draft” button to go away after the item has been “submitted”, so a rule can be created for this. Click to select the Save as Draft button. In the Rules pane, click the New button, and choose Formatting (to create a formatting rule). The condition needs to be FormStatus is not equal to Draft and FormStatus is not equal to New. Check the box for Hide this control. You can call this rule “hidden.
- Click the Quick Publish button at the top.
Now go over to SharePoint, to your new form library. Click to fill out a new form. Notice that even if you do not fill out the required fields (the ones with red asterisks), you can still click to save the form as a draft. If you try to Submit the form, though, the required fields must be filled out. You also may want to go through the publishing wizard again, if you’d like to add the form status as a column in the SharePoint library.
A new form will look like this:
Thank you very much for taking the time to put these instructions together.
I am having difficulty with step 14. I am attempting to add separate form submit options to my “save as draft” button, but the rule manager is showing all of my rules from my “submit” button.
I cannot add unique rules to each button. Do you know why this might be?
Isaiah here – I think my issue was that I had not published the form with both buttons.
After I published I was able to add custom action rules to my “save as draft” button.
Shame on me for not following directions 😉
Do you know of a way to have the draft version deleted from the draft library after it has been submitted to the main library. This would have to be a no code solution.
There is no separate ‘version’ in this solution. When they submit final, it overwrites the draft version. I guess if you have versioning turned on in the form library, then the versions would be there, though. So if you’re getting rid of those versions, you could create a workflow that says:
IF FormStatus is equal to Submitted, the delete all previous versions.
couldn’t you just work with two Content Types, one for “drafts” with fields set to “optional” and another one, where those fields are “required”? Is there a way to set the used Content Type before saving in InfoPath? I know there is in SharePoint Designer, when creating a new List Item.
Best regards from Germany,
PS: Just curious: why don’t you use a default value for “Today’s Date”?
No, form libraries work differently than lists. That would be another way to do it… with a SharePoint list, but it seems more complicated to me, and I’d really only do that if InfoPath wasn’t in the picture.
Oh, and I didn’t use a default value because then every time you submit the form, it would save it as the file name of the date right then. I want this value to be static, so I only set it once.
I have one requirement, want to achieve from OOTB only. no code,
User submits data to a list ( car list) i want to prepolulate the previous Car which they have submitted lastly, means need to pull the CarName from the latest submitted item by the user and pre-populate the same in the new form.
any help? how to retrieve the latest item submitted by a USER through OOTB?
You can do that. Create a receive data connection to the same library you’re in. Then, you can use the “username()” function to figure out who the currently logged in user is. Then, perform a query to the data connection to receive just the records created by the logged in user, sorted by ID descending. I’ll have to blog about this. 😉
I have implemented your solution and I also hide the Save as Draft button after submitting the form.
I face one problem. When submitting the form without providing the required fields, I get a warning pop-up with the options continue and start over. When I choose continue, the Save as Draft button is hidden since the field FormStatus is set before the submit action. How to make that button visible when choosing continue?
One way could be to have a submit action then set the FormStatus field and then submit again, since FormStatus is a promoted field in my solution.
Do you think this makes sense?
Good point. Here’s a trick:
In your actions in the submit button, add a “submit” action FIRST in addition to the submit action and the close action that you use last.
Great solution; however, when I apply the required rule to a date picker control it gives an error of “Only Date Allowed”, if the form is submitted without providing the required field.
Does it work fine for all other types of fields except dates in that situation? I’ve never come across this as a bug. Are there any other rules on your date field that may be conflicting?
This solution does not work when you have a required People or Person field. The reason for this is that you cannot set the field to required through rules.
Maybe you can mention this in your post.
Kind Regards, Rob
Ok, a couple of related and perhaps not related questions:
I’ve created two, web-browser InfoPath forms and saved them to a form Library. They don’t have the submit buttons/data connexions yet (but I want to add the two buttons you described here) – this was my first question and you answered it above.
Second ? How do I make my InfoPath forms be “New document” templates (whether for the doc set or a SharePoint doc Library)?
For the moment I’ve allowed my form library link be seen on the Quick Look bar for my sake, but later I’ll remove it, because I don’t really want users going into the form Library (only the forms’ administrators or me & I know I’ll have also need block with SP autorisations too.)
I don’t want the users to use the forms from the library to create documents, but as “New Document” templates in a custom document set. Why a doc set, because I want a sort of MS Binder (remember that) with multiple documents: some created from templates and others are user specific-added documents, and all of these documents are within one binder (doc set).
Some documents will have workflows and when the set is at state where the user is ready to submit the set, then a global workflow is activated by the user.
My third question is about the unique naming for each InfoPath form (Template). I don’t quite understand the translate(now(), “:-T”, “”) convention. I would like the unique name to have some user meaning: for ex. if the new doc Template is an InfoPath form for making a Marketing Plan, I’d like the name to be Marketing Plan (or an acronym of that) for X product. And since SP does versioning (I’d like the saved new doc to always have the same unique name.)
If a year from now someone wants to see what the MP for a product looked like they can simply use the SP versioning feature to look at it.
I hope I’m making sense. So, I really only have two questions, one on how to publish my already made forms as “new doc templates” and unique naming convention for new documents create from my forms that rewrites onto itself (since versioning is to be in place).
You need to create your form using InfoPath Designer, and then publish the form as a content type. Then, you add that content type to your library and/or document set. So the main thing you’re missing is that I don’t think you’ve published it. I wrote a whole chapter in my InfoPath book about the publish and submit process. It’s chapter 9 in “Using Microsoft InfoPath 2010 with SharePoint 2010 Step by Step”. I highly recommend it because that whole process is the most confusing thing to a lot of people.
thank u for the great post.
what is the purpose of the form load action u described in item no 18-20?
why set the status to new if its draft? the field remains new all the time.
in addition, i followed the instructions for the submit button.
when i press the button, im in a loop if the user didnt act correctly. in case the user didnt fill out all the required fields, the form status field get the status submitted while the form was not actually submitted. if i opposite the actions and start with the submit action, the field status doesnt change into submitted.
what can i do?
18-20 is all part of the logic to make it work correctly.
To fix your problem, at step 12, you can add a “submit” action to run first before all the other actions, and leave the other submit action in there as well. That way, the validation will run before the field gets change. An alternative to that would be to set the submit button to disabled if [your required fields] are each blank. (this is blank OR this is blank OR this is blank….)
Thank U for Great Post…………………..
I’ve followed all of you steps and when it comes to “required fields”, there’s a error message about error in validation statement I receive if I leave one of those fields blank. Is there a solution for this?
Also, I have the same problem of someone that just asked you. When I submit a form which I had saved as a draft, it creates a new version of it. Is there a way of replacing the file?
You’d have to decide which fields absolutely need to be filled out even if it’s a draft, and if you don’t absolutely need them the first time, do the validation rule at steps 21 and 22 and don’t set them as “cannot be blank”. Also, as for the filename, be sure to uncheck the box you see in screenshot #1.
I think you have a typo in step 20, this should be set to “Draft” not “New”….correct?
The step is correct how I wrote it, but feel free to try it both ways, and take a look at what the resulting functionality is for both methods.
I have everything setup in SP2013. The only question I had was, when I submit the form from the library (after saving it as a draft), the form in the drafts library is not deleted. I know you mentioned in your post that it should be (Because of the overwrite which we put into the data connection), but I can’t get it to delete.
Do you have any specific suggestions about what to do? Or if there is a workflow I can write?
I’m not deleting anything here. This is all using a single file. Did you uncheck the box in that first screenshot at step 1? There isn’t any reason that multiple files should have been created at all.
Awesome Post Laura!!
I was having some issues with the HIdden rule, until I came up with a small modification that worked for me.
I added another field under my submission grouping and called it “DraftSubmit”. I set a default value of DraftSubmit and set a rule to run when the Save as Draft button was clicked which would set the DraftSubmit field value to In Progress. I then set my Hidden rule to only operated when the DraftSubmit Value equalled In Progress.
As a result – my form now works beautifully using Laura’s method.
Thanks – this was a great help in my work. I don’t have a twitter handle – but you can get me on FB @meghanthefairygodmotherKemp
Awesome that you dug in and made it work the exact way you wanted it. 🙂
Laura, this is an awesome post, It worked like a charm! you saved me tons of research to find the solution for a “Save” button on the Form. Thank you so much!
Laura, this is an awesome post, It worked like a charm! you saved me tons of research to find the solution for a “Save” button on the Form. Thank you so much!
I have an existing form with a Submit button, when I go to Submit Actions on the ribbon and verify that “Perform custom actions using Rules” is selected – click OK. I then select the button and create rules. I click away from the button and select it again – the rules are gone.
Not sure what I’m doing wrong…can you help?
Never mind I figured it out.
Laura, I am having an issue with the “Save as Draft” button I added the rules as the instructions say and get the following when I try to save the form:
An error occurred while using the form. For more information, contact the site administrator.
An entry has been added to the Windows event log of the server.
Can you please help?
I am receiving the same error, were you able to resolve?
Hey Laura, thanks for a great post, but I have one issue which is I have 2 people picker fields and if these are required (which they are) then the save as draft doesnt work because of them. Another commenter put the same:
“This solution does not work when you have a required People or Person field. The reason for this is that you cannot set the field to required through rules. ”
Do you have a workaround for this that would still allow this draft functionality to work?
As per your instructions
“18-20 is all part of the logic to make it work correctly. ”
are not required because we are setting the field value to draft on click of “Save as Draft” button.
Is there any other reason to set the Form load property
I followed your instructions for InfoPath 2010 and everything worked well. My client wants the Submit button on the form and ribbon. Fortunately, I was able to get both to behave as Submit & close the form; whereas the Save buttons on the form submitted but did not close the form. When InfoPath 2013 was installed and I published the same form to the same SharePoint library, the Submit button on the ribbon disappeared even though it was correctly selected to appear in the ribbon! I discovered that InfoPath 2013 has slightly different settings on the Submit Data Connection dialog box. I made the new selections and now the Submit button appears in the ribbon. However, it submits but does not close the form! I’ve searched the MS and InfoPath Dev forums for a solution to this issue. I haven’t found any report of this issue.
Have you seen this issue? Have you tried to do your steps written here in InfoPath 2013?
I need a solution ASAP because my client demands having a fully functional Submit button on the ribbon and the form along with the Save buttons on the form as per your instructions. My client is our government, so I’m sure you understand their expectations.
Thanks in advance for your help! You are THE InfoPath guru and I have full faith that you will find the solution to this!
I usually just disable the submit button on the ribbon, or remove the ribbon altogether. That’s in Form Options.
This looks like a terrific option; will this functionality also work for a SP List or only for a SP Library? I’m working with SP/InfoPath 2010.
Yes, it’s the same, you just don’t need to do step 5 if it’s a list.
I’ve followed all of you steps and so far the solution works, but when it comes to “required fields” I have an issue. If I leave a required field blank and click Save As Draft I get an error message that since the field cannot be blank I can’t proceed. I’ve seen a couple of questions listed in the comments but now resolution. Any help would be appreciated.
Thank you for the great post. It was just what I needed 🙂
How ever I have some trouble with the value translate(now(); “:-T”; “”). I am pretty sure I have done it the way you wrote it. I havee even comparede mine to yours.
I have added translate(now(); “:-T”; “”) to Value and unticked the “Refresh value when formula is recalculated”. But my field gets populated with random numbers when I open a new form, and when I open a draft, and try to save it again, I get error message saying that the filename already exist.
I hope you can help me:-)
Maria – Denmark
After reading you post again, I see now that I misunderstood the “translate(now…” part. My filename needs a specific name, which the user has to fill in. So I deleted it. And now it seems to work.
I have a need to create several moderately complex forms that work together in documenting an analysis. I have a need to use the instructions you have provided within site: https://wonderlaura.com/2012/01/01/infopath-save-draft-form-functionality-a-better-way/
When creating forms that allow different types of users to perform analysis save for a period of time when performing assessments then, submit for review, approval, and publication to a SharePoint site. At your convenience please contact me because I’m having an issue with publishing within SharePoint; receiving error code I’m not familiar with.
the error code displayed after following your instructions:
“correlation ID: 73ba999e-c004-7000-1256-e06b9e90f7f7”
I’m double checking to see if my issue is pilot error.
Would you be able to share your sample file?
LOL, no I wrote this blog post almost ten years ago.
I have a requirement of always creating new record whenever a record is edited.
How I can save a separate copy of records every time user makes changes/edit it.
Want to achieve it using InfoPath. Please help.