The Create List Item workflow action does not work in document library with document template

My end goal is more complex but below is a basic example of the issue Im having that just simply does not work.

I'm trying to use a site workflow to create an item in a document library that has a document template applied to it but the file that gets created by the workflow is corrupt and cannot be opened.

I created a document library and edited the document template by adding some text to the header and changing it to a Word docx file instead of a Word dotx file. I tested the document template by clicking the files tab in the ribbon and then clicking new document which opens the document template in Word and allows me to edit and save the document back to SharePoint. Then I created a SharePoint 2013 site workflow in SharePoint Designer that contains a single Create List Item action, and that action creates an item in the document library with the name field statically defined. I published the workflow and then manually start it on the site. The workflow completes successfully and when I navigate to the document library the document has been created by the workflow. When I click on the document to open it in the Word Web App it throws the error pictured below and if I open it in the Word client application it just opens a blank document and not the correct document template.

Word Web App Error

I also tried using a SharePoint 2010 workflow with pretty much the same results. Opening the document in Word Web App gives the same error as above and opening the document in the Word client application gives the error pictured below.

Word Client Application Error

Come on Microsoft creating a Word Document in a SharePoint Document Library from a SharePoint Workflow should just work! Is this a bug or does anyone have any ideas on what is causing the this issue?

August 20th, 2013 8:52pm

I have the same issue and researching found many others with this same problem. Looks like I will need to use up one of my limited calls to find out if this basic functionality has a work around or a fix.
Free Windows Admin Tool Kit Click here and download it now
August 21st, 2013 2:53pm

Did you find a work around or a fix for this?
August 29th, 2013 6:59pm

I might be late in replying to this question; but for anyone who is looking for an answer.

In your workflow you need to select "ContentTypeId" and set it as your custom document template (.docx) for it to work. This is done at the place where remaining fields are  mapped.

  • Proposed as answer by NBurgess Thursday, March 13, 2014 9:31 AM
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2014 11:21am

I'm having the same problem and I confirm that I have (i) selected "Content Type ID" and set it to my custom doc template, (ii) that the template works outside of the workflow, and (iii) the workflow completes without an error. Thanks!

February 18th, 2014 4:30pm

Yes Shannon, I also tried using a content type with a document template and specifically chose it's Content Type ID but still the workflow creates a corrupted document.

Free Windows Admin Tool Kit Click here and download it now
February 18th, 2014 4:40pm

I had the same problem with corrupted document - this worked for me:

1. Create a 2010 Workflow which creates the list element in a document library
(you may start this workflow from your 2013 workflow if applicable)

2. In the Create New List Item properties - make sure to set ContentTypeId to your content type
("Id for indholdstype" is Danish for "Contenttype ID")

3. Your Content Type template should be a ".docx" file - NOT a ".dotx" file...!

(I have always created my templates for content types as .dotx files - seems Microsoft wants us to use ordinary .docx files as template files for content types)

Hope this helps you!

March 12th, 2014 9:51am

Me too - until I changed the template from a dotx to a docx file - works now!

Nathan

  • Proposed as answer by SJNBham Tuesday, December 16, 2014 12:31 AM
Free Windows Admin Tool Kit Click here and download it now
March 13th, 2014 9:30am

Just to be clear, I got this to work by specifying a .docx as the content type template vs. the default .dotx which failed. 
December 16th, 2014 12:29am

Hi,

I also have this problem and I'm using a .docx.

Am using Onsite SharePoint 2013, SPD2013 with 2010 workflows and Word 2013.

When I add a document with a .docx template from a content-type using the New Document button on the Files Ribbon I am able top open with Word 2013.

When I add it using the "Create List Item" action in a 2010 Workflow it is created but when I attempt to open it with Word 2013 I get: "Were sorry. We cannot open <var class="sbody-var"><file_name></var> because we found a problem with its contents."

The article at support.microsoft.com/en-us/kb/2889634 suggests a workaround but this would remove any benefit of using content types.

The article then goes on to explain that the problem is by design. Can someone at Microsoft please explain?

If anyone has any suggestions I'd really appreciate it. At the moment I've hit a roadblock as I really want to create a document from a content-type that is pre-filled with data from the site.

Many thanks.

Free Windows Admin Tool Kit Click here and download it now
July 6th, 2015 10:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics