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:


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
<Custom> <MSCRM xmlns="mscrm">&lt;ReportFilter&gt;&lt;ReportEntity paramname="CRM_FilteredAccount"&gt;&lt;fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"&gt;&lt;entity name="account"&gt;&lt;all-attributes /&gt;&lt;filter type="and"&gt;&lt;condition attribute="modifiedon" operator="last-x-days" value="30" /&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;&lt;/ReportEntity&gt;&lt;/ReportFilter&gt;</MSCRM> </Custom>


node with

<Custom xmlns="http://schemas.microsoft.com/crm/2006/WebServices" xmlns:mscrm="http://schemas.microsoft.com/crm/2006/WebServices"> <MSCRM xmlns="mscrm">&lt;ReportFilter&gt;&lt;ReportEntity paramname="CRM_FilteredAccount"&gt;&lt;fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"&gt;&lt;entity name="account"&gt;&lt;all-attributes /&gt;&lt;filter type="and"&gt;&lt;condition attribute="modifiedon" operator="last-x-days" value="30" /&gt;&lt;/filter&gt;&lt;/entity&gt;&lt;/fetch&gt;&lt;/ReportEntity&gt;&lt;/ReportFilter&gt;</MSCRM> </Custom>


and could publish the report using PublishReports.exe without problems.

Best regards,

Philipp



English version of Column on Channelweb

An article that I wrote some weeks ago for Channelweb was published in Dutch. I have translated the article because of the many requests that I got. Read here the English version of the column 'The power of choice'.

The power of choice

Microsoft will release the newest version of its much discussed product Microsoft Dynamics CRM in 2007. There are big changes to come which will make it possible to use this application in even more organizations.

The market of Customer Relationship Management was entered by Microsoft in the end of 2003. The first version was primarily aimed at small and medium businesses, but also enterprise organizations implemented this application. Microsoft Dynamics CRM 3.0 was released in December 2005 to serve all target groups at best. Better scalability as well as a service oriented architecture (soa) was added for the large organizations and a partner hosted solution has been made available for the smaller organizations.

The successor of Dynamics CRM 3.0, which is still known under the codename Titan, will offer the clients even more choices. This Titan-release will be able to run multiple installations on the same server (multi-tenancy). The hosting partners are not depending on virtual servers anymore because of this multi-tenancy. Therefore they can lower the prices even more. Also Microsoft will offer CRM as a service themselves under the name CRM Live. This offer will be available in North America in the first place. International releases will follow as soon as possible.

International employees of a multinational will be able to work with Dynamics CRM when working with this Titan-release. This release will enable the users to choose their own language (multi-lingual) and own currency (multi-currency) within one installation. This means that large-scale, international operating companies with multiple establishments and business units can use Dynamics CRM even better. And they can do that from one centralized maintainable organization or from a decentralized maintenance organization on a hosted environment. Another large change is the extension of workflow possibilities. Dynamics CRM does now use its own workflow engine, but this will be replaced by Windows Workflow Foundation in Titan. This will further improve the integration with other Microsoft applications.

The new possibilities mentioned above do give the clients many advantages. Not only the SMB but also the enterprise organizations can optimize the use of CRM with these advantages. Microsoft does let the client choose between different offerings of CRM, but the final choice stays with you. What will you choose for?

Ronald Lemmen
Senior Associate Consultant at Avanade Netherlands



Modifying the history (associated) view filter

One of my friends, Michael Höhne, has blogged about how to change the default view of the associated view. This is a very common requested feature, also by my clients. Usually I inform them that it is not possible to change it, but that will change as of today. Take a look at the post at this address be thankful that Michael is willing to share all the codes just for the community :)

http://www.stunnware.com/crm2/topic.aspx?id=JS11



New blogger

As you can see I have changed the blogger settings to match the new blogger style. This does mean that labels are now used, the history browser is optimized and I should have some new features as author. I still have to find that out, but for now the template is a bit changed. I'll work on that soon!



FetchXML into a DataSet

Once upon a time in the Netherlands there was this developer who was working on MSCRM for quite some time. He started to notice that he had to search again and again for the same questions. Luckily he heard about the term 'blogging' and so he started to post the most frequent questions on a blog. The goal was to be able to quickly retrieve the information that he had found earlier. The fact that other people also read his blog and save themselves time to figure everything out themselves is just an added value to the blog.

Now with this knowledge you will understand why I post this piece of code:


private DataSet FetchDataSet(string fetchXml) {
CrmService service = new CrmService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
//service.UnsafeAuthenticatedConnectionSharing = true; //enable in secure migration programs

string strResult = service.Fetch(fetchXml);
DataSet ds = new DataSet();
System.IO.StringReader reader = new System.IO.StringReader(strResult);
ds.ReadXml(reader);
return ds;
}

I'm just typing this way to often and I prefer to use copy and paste.

Furthermore a link to a previous post on how to quickly create a fetchXML:
http://ronaldlemmen.blogspot.com/2006/11/using-advanced-find-for-fetchxml.html

And a link to another post on how to make sure that you do fetch all records and not only the first 5000:
http://ronaldlemmen.blogspot.com/2006/08/fetch-all-records.html



Copying CRM Reports

You will need to copy reports from a server to another server when you're working on a CRM project, right? From development to test, from test to staging, from staging to production. Usually I do add the reports to a release package and describe in the deployment manual how to deploy the reports and how to set the filter, categories etc.

Until today. Since today I will do this completely different. For a friend of mine I was searching for information on an error he receives with reporting:
An error has occurred during report processing. (rsProcessingAborted). Query execution failed for data set 'dsContracts'. (rsErrorExecutingCommand)
Unfortunately I did not find the anwer to that error, but I did land on this page: http://www.microsoft.com/dynamics/crm/using/deploy/changesrs.mspx

There is being described how reports can effectively be migrated from one deployment to another deployment! There are two executables which I overlooked: downloadreports.exe and publishreports.exe. By using these two executables you can download the reports and configuration settings for the reports and publish these reports and settings on another machine. That will shorten the deployment time a lot and make it less errorprone!

As you can see, everyday I learn something new. I hope this helps you as well.



This attribute map is invalid

Today I've been working on a nasty error which showed up during importing customizations. The error message was:

This attribute map is invalid. The selected attributes should be of the same type. The length of the source attribute and the formats should match. The targe attribute should not be used in another mapping."

To solve this error I have opened up the customizations.xml file and located the attribute maps ("ctrl + f" and search for AttributeMap). There were many custom build maps between exisiting entities. To find out which of these caused the error, I have removed them one by one until the error did not show up. That was the record that I needed to check and indeed that was the problem. The source entity did have this particular attribute set as a picklist and the destination entity had the type of the attribute set to bit. In the CRM system where I created the customizations file, both attributes were bits.

I hope this approach does help you solve the issue as well. Good luck!



CRM Blog list update

Today I received a comment on the post around CRM Blogs from David Yack. If I wanted to update his entry in the list. Ofcourse I did so. In fact, I have searched around the internet and updated the complete list. I believe all records are up to date. If any MS CRM related blog is still missing, please let me know. Here's a link to the list:

The official MS CRM Blog List:
http://ronaldlemmen.blogspot.com/2006/03/crm-blog-world.html