Word Templates not printing to the screen on a Citrix Environment
We have had a few instances where Dynamics GP Word Templates will not print out to the screen when running on a citrix environment.
I’m happy to say that I think we have figured out what is causing this specific issue.
Symptoms:
The symptoms are that you have set up Dynamics GP Word Templates, but when logged into a citrix
environment, when you attempt to print the template to the screen, it appears nothing happens. Word does not
open. In this scenario, the templates will not print to the printer either.
Troubleshoot:
The first thing that you want to do is make sure to troubleshoot the problem in GP so you make sure that you have everything set up
correctly. You would want to check security so you know what report writer report is printing (modified, modified
alternate, etc.), make sure you have a template set up for that report. Make sure the template is assigned to the
company you are in and is set as default. In this scenario, remove any customer/vendor assignments on the
templates. When the templates are assigned to customers/vendors, it complicates the scenario because there can be
multiple word templates being used and you want to eliminate that for baseline testing. You can add the customer/vendor
assignments back after you have the templates working. Once you have verified these things, the
template should print.
In this scenario, the TPElogging helps because if you have logging turned on, you should be able to
see that the word doc is being created, but it’s just not opening in word. That would prove that the word doc is being
created correctly.
Code:
I don’t want to get too technical here but I do want to shed some light on what GP is doing to get the word template to print out to the
screen. This process is handled by the Microsoft.Dynamics.GP.BusinessIntelligence.TemplateProcessing.dll
in your addins folder under GP. This dll handles most of the template processing.
When it gets to sending the word document to the screen, the dll is using the Process.Start(ProcessStartInfo) method in the
System.Diagnostics namespace. In this call, we are passing an “Open” verb in ProcessStartInfo. What this will do then is open whatever
document we are passing in its associated program. In our case, it is a docx file which should be associated with Word. However, this
works for any application. So if you called this same method with a pdf file, it should open the pdf in Adobe or
whatever is associated to a pdf file. So it’s a universal way to open a document.
Cause:
Upon extensive investigation, what we found is that in some Citrix environments, Citrix has a Windows Shell Extension that is intercepting
these calls to Process.Start() with the “Open” or “Print” verb and it’s preventing the application from opening.
In the two cases that we had this issue, the problem wasn’t specifically with Word, no application would open when called this way. We tested pdf’s and txt’s and those didn’t work either. In this case, the Citrix Shell Extension was CtxSFOShellExt.dll and it was located in the following
directory:
C:\Program Files\Citrix\Server Resource Management\Memory
Optimization Management\Program\CtxSFOShellExt.dll
It has something to do with Memory Optimization with
Citrix. If you right click on a file, there was an additional option for Citrix Memory Optimization. When we chose that option, it would not let
us open the document because it wasn’t optimized. I believe this Shell Extension has a handler
that is catching the “Open” and “Print” verbs and checking if the document is optimized. If it isn’t, it doesn’t let
them open. A Citrix engineer may have more information on this particular Shell Extension.
Resolution
I’m not recommending anything specific here other than contacting your Citrix engineer on how to
disable this Shell Extension. However, there is a program available from Nirsoft that allows you to view and disable
Shell Extentsions that may able to help you. You would be doing that at your own risk because by disabling this, you
could cause other issues with Citrix. The best bet is to talk to Citrix about it. We did find however that disabling this Shell
Extension did allow Word Templates to work on the Citrix Environment.
Enjoy!
Dave D