Skip to main content

This is a simple trick that I've been using for a while that allows you to have some of the Draft capability without having to turn on Content Approval and versioning. Which let's be honest is a little much in some cases. The trick is to use 2 buttons on a form, one "Save as Draft" the other "Save and Submit". In the list, create a hidden column and call it "Draft".  This column needs to be a "Single line of text" field (It doesn't need to be hidden this is just my preference.)

 

Now lets configure those buttons.

179050_pastedImage_1.png

Firstly let's configure the "Save as Draft" button. Under 'Advanced' connect the button to the new field 'Draft'
179051_pastedImage_2.png

Once you have connected that, type "yes" into the field 'Value returned'

179052_pastedImage_3.png

Repeat this process for the 'Save and Submit'

179081_pastedImage_0.png

 

Both these buttons save the information back to the list.. Difference being; when I use the 'Save as Draft' button the 'Draft' column value is set to 'Yes'

179082_pastedImage_1.png

 

So this is great you say, now this is where we head to the workflow and place in some rules to hand this..

For Workflow On-Prem you have the ability to put in some conditions on when a workflow should start. You can find these setting in the ribbon under 'Workflow Settings' and then change 'Start when items are created' to 'Conditional'

179084_pastedImage_3.png

So for this example, select 'Conditions' and you want workflows to start on create only when the 'Draft' column equals 'No'

179083_pastedImage_2.png

Now change the 'Start when items are modified' to 'Conditional'

Here we need to add 2 conditions. Because we only want to start the workflow when the item was a draft previously and now it isn't. The reason I don't use a compare is that for some reason I changed a published item to a draft, I wouldn't want to the workflow to run.

179085_pastedImage_4.png

 

Easy right !!

But let's say your in O365 and you aren't able to use start conditions. All we need to do really is build this same logic into the start of the workflow.

Firstly we need to change the workflow start settings to run the workflow when the item is created and also when it is modified

179086_pastedImage_5.png

First action we want to place is a 'Run If'

179089_pastedImage_9.png

179092_pastedImage_12.png

Now because I don't have the ability to look back at the old value, I'm going to create a new hidden column to store that, so I can check it as part of my logic.

I've created a new column called 'Draft Old Value', and I've got a couple of 'Set field value' actions mixed in now as well, to ensure the 'Draft Old Value' is set right. You'll see in the picture above that I have an action there that sets that field to 'Yes' before it terminates the workflow.

Now we need a second 'Run If', to handle the situation when a draft item is now published. This run if, will allow through items that were in draft but are now published. Items that were published and have been edited, will not continue

179093_pastedImage_14.png

With the following settings.

179090_pastedImage_10.png

 

Notice that after the 'Run If' there is another 'Set Field Value'. This will set the 'Draft Old Value' to No, meaning that once the workflow has run through the first time as a published item. The filed will be set as so when it is edited again, the workflow will cancel out. If the published item is saved as a draft again the first 'Run If' will get it and set the "Draft Old Value' back to Yes and the cycle will start again.

 

So hopefully this helps out when you have the requirements around emulating 'Draft' functionality in a SharePoint list.

 

Until next time happy.png

This is great, thank you so much!


In the workflow there are some cases when this Yes/No solution is not enough.

When you publish a new workflow version or your workflow stops with error right after an item modification, the condtitional workflow start triggers again. And a new unnecessary workflow will start.

To avoid that, you have to change the conditional start value. E.g.: IsDraft in number type,  0 = Draft, 1 = Can Start, 2 = Already Started. The conditional start will eb triggered if the IsDraft=1, and the first step of the workflow is to change that to 2.


One issue I've come across with this solution is that logic needs to be added to every form validation rule so that the form can be saved without all of the required fields entered. While this isn't a big deal for smaller forms, for larger forms with extremely complex field validation rules this is a big issue.

Do you know if there is a way to suspend the validation rule checking when Save as Draft is clicked and only have the validation run when Submit is clicked, other than adding this logic into each validation rule?


I need this too if there's any.


How about simply adding an 'ItemStatus' field to the form and include it in the validation rules.

For example, options for ItemStatus are Draft and Final.

The validation rules only apply when the form is Set to 'Final' and Other requirements.


That is what we have currently implemented, but depending on the size of the form this can add a considerable amount of extra development effort. Also, given the complexity of some of our validation rules adding one more check into the rule adds unnecessary complexity.

As the Saving without closing a form feature was released this month, this issue is no longer relevant. 

Here's the link to the User Voice item where the release was just announced.

Saving without closing a form – Customer Feedback for Nintex 


Great post.  Thanks Dan


What about the validation rules on the form? Our form will not submit (for the Draft as well) if some rules are failing. I think we have to move those rules to script level, and only run them when we are actually submitting the form.


Reply