My end goal is more complex but below is a basic example of the issue I’m 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.
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.
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?
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.
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
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!