Deploy Dynamics365 Document Templates (Word & Excel)
A blog post by Robert Pröll
Posted: 04.2019 | Category: DataTransfer | Author: Robert Pröll Tags: DEPLOYMENTS DYNAMICS CRM TEMPLATES WORD EXCEL
The default template functionality for word and excel documents uses entity type codes (etc) instead of logical names for entity and attributes.
This causes import issues due to the fact that etc‘s might be different on each environment.
(for custom entities, values start at 10.000)
Identify the issue:
Documents with an invalid etc can be imported but the field Entity Type Code would be empty, which means it cannot be used.
How to solve it:
The solution is pretty simple if we know the entity type codes for both systems (otherwise it can be retrieved via the Metadata Service (SDK)):
- Rename and extract the document file (e.g. Overview.docx => Overview.zip)
- Open the directory (The picture shows a subdirectory)
- Then all occurrences of the old etc must be replaced. There are some ways to solve that. A quick search and replace with a pattern like ([LogicalName]/[ETC]) works in most cases but is risky. A clean regex and validation is a better solution.
It’s important to apply the change to all documents within the zip:
- Afterwards zip the files again and rename it back to the previous extensions. E.g. Overview.zip => docx
- Upload the document to crm. Double check if the etc is correctly set in crm.
.NET Software Architect
Key areas of interest: ALM, .NET C#, PowerShell, Azure, Dynamics 365 Tooling
Robert started in the area of ASP.NET projects and has now more than 10 years of experience in the international Dynamics Enterprise business.
He works mainly as a principal software architect at Kupp and as an external consultant for Microsoft.