Tips on using the publishreports executable
Update: see the bottom for a solution to be able to use the filter in the report!
Some days ago I posted an article around how to move reports from a server to another server in the development process. Now I've been working with it, I can share some tips.
The first tip is on how to publish the reports. How does the publishreports.exe know where to find the publish.config and the reports? This wasn't completely clear to me on this page. It appears that you will need to go to the folder that you have created in the first step by using downloadreports.exe. Then you can do two things. Either call the publishreports executable on the server, by default on the location "C:\Program Files\Microsoft CRM\Reports\PublishReports.exe" or you can copy the file publishreports.exe and the file "Microsoft.CRM.Tools.Logging.dll" to the same folder and run publishreports from there. This will allow you to create an installer application because you know for sure that the publishreports executable is in your folder. You cannot be sure that the executable is in the c:\program files folder because thats a choice of the person installing CRM.
Furthermore you will notice that the publishreports will throw this error on your reports:
15:40:08 Error Publishing stopped due to following error
15:40:08 Error SRS soap exception: The report definition is not valid. Details: The element 'Report' in namespace 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition' has invalid child element 'Custom' in namespace 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition'.
List of possible elements expected: 'http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Description http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Author http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:AutoRefresh http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:DataSources http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:DataSets http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Body http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:ReportParameters http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Code http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:Width http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:PageHeader http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:PageFooter http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition:PageHeight http://schemas/....
This error is caused due to the filter that is set in your report (by default set to last modified within the last 30 days). Each report has a layout like this:
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="CRMDEV30_MSCRM">
<ConnectionProperties>
<IntegratedSecurity></IntegratedSecurity>
<ConnectString></ConnectString>
<DataProvider></DataProvider>
</ConnectionProperties>
<rd:DataSourceID></rd:DataSourceID>
</DataSource>
</DataSources>
<PageWidth></PageWidth>
<rd:DrawGrid></rd:DrawGrid>
<InteractiveWidth></InteractiveWidth>
<rd:GridSpacing></rd:GridSpacing>
<rd:SnapToGrid></rd:SnapToGrid>
<Body>
</Body>
<rd:ReportID></rd:ReportID>
<DataSets>
<DataSet Name="CRMDEV30_MSCRM">
<Query>
<rd:UseGenericDesigner></rd:UseGenericDesigner>
<CommandText></CommandText>
<DataSourceName></DataSourceName>
</Query>
<Fields>
</Fields>
</DataSet>
</DataSets>
<Code>
</Code>
<Width></Width>
<InteractiveHeight></InteractiveHeight>
<Language></Language>
<PageHeight></PageHeight>
</Report>
In your report you will find one more node between the pageheight and the end of the report:
<Custom>
<MSCRM xmlns="mscrm"><ReportFilter><ReportEntity paramname="P1" displayname="Contacts"><fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="contact"><all-attributes /><filter type="and"><condition attribute="modifiedon" operator="last-x-days" value="30"/></filter></entity></fetch></ReportEntity></ReportFilter></MSCRM> </Custom>
Remove this line from your report and you will be able to import the report. Keep in mind that you will have to set the default filter for your report afterwards!
Update:
One of my colleagues, Philipp Uihlein, has sent me an email regarding this blog post. He has found a way to keep the default filter in the definition! See his text for the details:
Hi Ronald,
I found out that the tool can handle the <Custom> tag when you add a namespace to the xml.
In the Account Summary.rdl for example I replaced the
node with
and could publish the report using PublishReports.exe without problems.
Best regards,
Philipp
1 comment:
I can deploy all my reports to the new server, but I'n not be able to copy the default filters for each report. When I open the uploaded reports on the target server, my default filter are missed and crm show me the default one.
How can i solve this problem?
Post a Comment