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 form.crm.htc 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 form.crm.htc 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.
A+