Search code examples
dynamics-crmadd-on

Document Core Pack not printing correct template


I am using DCP with MS CRM to print documents based on templates. I have multiple templates for different business units. I follow the code during debugging and the Guid is pointing to the correct template. It goes to the printer and prints out the wrong template.

Things I have looked at;

  1. I know its damn near impossible but have two templates fluked the same Guid? No
  2. Does the correct template have the wrong information. No

I don't understand why its happening. Right up to the point of printing, the Guid IS the correct Guid for the correct template. When I go to the printer, wrong template with the right merged feilds. And the template is attached to the order. (Which is also wrong)

== UPDATE == Looking into the database, there are 2 templates with the same name. However only 1 of them shows in the list in Word so I can not see the content of the other. Still looking for solution.


Solution

  • There were two templates in the database. One of them was inactive and one active. My code was selecting ALL templates with that name and giving back the first or default one.

    I changed the code to only select active templates. This solved my problem.