How do I move my word template for custom entity across environments in Dynamics 365? How can I make the changes manually? – A deep dive into inner workings
It was just another day at my office and my client’s developer just walked up to me and asked – “How do I move my document templates to one environment to another?”. He seems to have manually uploaded in the target environment but that is not showing up the data in the target environment environment when then word template is downloaded.
If you have worked on word templates, you know that this will not work as the custom entity object type codes are different between the source and the target environment. If you are new to word templates, please remember that the entity in your word templates are reference by their object type codes instead of their logical name. So even though you migrated the solution, the object type code of the custom entity will most probably be different and hence this would not work out in the target environment.
So I asked him to use the wonderful XRM toolbox which has the ability to do the same.
Worked like a charm like all other XRM toolbox plugins.
But the ordeal does not end here. Every now and then I get a question – “Can you explain what’s happening underneath? Can I do it without using a tool? Can you tell me where the changes are being made”.
Honestly I am not in favour of not using an utility when it is available. But if you want to dig deep, continue reading. Or may be you are getting an error with the tool and this might just save your day.
We all know the word and the excel files are essentially zip files. I just save my word template with .zip extension.
Now since its a .zip file, I can unzip the same.
In the folder I search for the object type code which in my case is 10426
I just open the three files in a XML editor of my choice and then replace my the object type code 10426 with the new objectypecode of the custom entity in the target environment – 10341
I save the files. And then i select all the contents and then re-zip it.
And then change the .zip extension to .docx extension.
And finally when you upload the template in the target environment, it just works fine.
I am not sure when you would do this manually but if you want to really do it and go under the hood, here it is for you.
And sometimes when you get an error, this way may just help you out.
Debajit Dutta
(Dynamics MVP)
For consultation/ corporate training visit www.xrmforyou.com or reach out to us at info@xrmforyou.com
This was originally posted here.

Like
Report
*This post is locked for comments