Saturday, December 12, 2009

Customize Dynamics CRM 4.0 entities print preview forms

(Changing the entity’s default print preview to a custom implementation)

One of the most annoying drawback which was raised by my clients ever since CRM 3.0, was the dull and inflexible print preview form of CRM entities. Needing to print out every day several types of records on such print previews and file them, turned out to be a real burden using the default print preview.

The main complaints were about:
- the layout of the print preview form is not customizable (layout, position of fields, adding or removing fields etc)
- the look (the design) cannot be customized (e.g. adding a company logo, colors, fonts, etc)
- the child collections’ information cannot be added to the print preview screen

One of the most efficient approaches to implement your own print preview page for any entity form is to perform the following steps:
1. create a custom CRM / SSRS report to be used as print preview for that entity
2. update the file with a code which checks if there is a custom report defined for the current entity to be loaded instead of the default print preview. In case there is one, the customization will load that report page instead of running the default print preview page.

- Add in Global.js file an array with the entities supporting custom reports for print preview:

var PrintPreviewReports = new Array(); PrintPreviewReports[Lead] = "Print Leads"; //This is the report name

- Add the following code in the at the beginning of Print() function:

if(PrintPreviewReports!=null && PrintPreviewReports[_oSubmitForm.crmFormSubmitObjectType.value]!=null) { RunReport(true, PrintPreviewReports[_oSubmitForm.crmFormSubmitObjectType.value], "", _oSubmitForm.crmFormSubmitObjectType.value, PrintPreviewReports[_oSubmitForm.crmFormSubmitObjectType.value]+".rdl", 1);}

The approach is rather simple for a developer; once the customization has been set in place and you have a first model for a report, then it should take about 30 minutes per each new report to implement in order to be used as entity print preview.

Here’s the sample screen for this solution in production:

That’s it. Let me know if you find this useful.



  1. Adrian,
    This is quite a nice trick; i've been considering to implement something similar but your hint comes quite in handy.

  2. Hi Adrian,
    I was looking for simillar solutions. Great article. I will subscribe your blog

    My Dynamics CRM blog

  3. I like it - a lot :-)

  4. nice article..
    thanks for the trick...

  5. We only needed the standard information on the screens, so just created a merge form that gave us what we wanted in the order we wanted it and how we wanted to see it. But if you need more than you can get with a merge form this looks excellent.

  6. This is quite a nice trick...keep submit more...