How do I change the Dynamics XML Schema in the Word Template

OK - so you have a Word Template that was created at some point in the past and you now need to add additional fields to the template

Applies to:

  • Microsoft Word and Dynamics Templates



This blog assumes you have access to the original/current MS Word Template document. If not - I’ll add details on how you can export this using XRM Toolbox at some point and link it here.


Adding The Fields

OK - so this contains a couple of steps to get to the XML Schema. At this point Im assuming that you know how to get the database schema names for the fields you need - if not, try checking the Power Apps solution for your Dynamics to get the field names.

Add Fields in XML Mapping of Existing Word Template Used In Dynamics 365 CRM

1 Locate your Word document and change the file extension; from DOCX to ZIP
NOTE: For some reason I was not able to correctly extract the file using my Mac, and resorted to using a Windows powered laptop.

2. Open the zip file and navigate to the CustomXML folder

4. Copy the item1.xml file to your desktop

5. Locate the file item1.xml and open this file using NotePad or your favourite text editor

6. You’ll see the content of the xml file looks similar to the xml generated by ‘Advanced Find’ or other Dynamics FetchXML.

7. Insert your new field into the attributes list and save the text file using the same format as the other attributes in the file.

8. Copy the file back into the zipfile

9. Rename the extension of the zipfile back to ‘docx’

10. Open in Word and test that you can now see your fields.

Add Fields From a Related Table in XML Mapping of Existing Word Template Used In Dynamics 365 CRM

Ok, this is a little more interesting but doable.

First you’re going to need to get the name of the relationship between your primary table and the secondary table.

eg. If you want contact information to show on a report/word document focused on the accounts table, you’ll need to locate the 1:Many relationship name. This can be found in the make-powerapps under the relationship node for the table.

Next, follow the steps above, until you get to step 6. Here you will need to insert the relationship name, and then nest the attributes under the relationship name node.

If you want to nest another relationship, you must add the close tag to this relationship first.

If you want to add another relationship that is further related, this must be WITHIN the relationship tags.

 

Interested to learn more ?

Im gonna be honest - Dynamics 365 is one of those tools that is an incredibly powerful platform for your organization. With that power, comes a certain level of complexity. If you’d like to get some real answers about how Dynamics can benefit your organization, give me a call for a quick chat to see if it’s an option for you.

Give us a call at 604.337.1720 or email info@dominicsystems.com


Related Content:


Need help choosing a CRM? Click here for our common questions and info.


Previous
Previous

Q&A: Is Microsoft Dynamics 365 Free?

Next
Next

Power Automate Not Licensed?