How to get the URL to the reportserver programmatically

I was searching the net the other day to try to find a way to programmatically get the reporting server url from CRM. I thought that there must be some way to find it using the standard CRM webservice and I really looked throught the SDK and all the blogs I could find to see if anyone knew.

Finally I gave up and tried to find some other way to get it and I remembered that it is set in the registry so I wrote some code to get it from there and here it is in all it’s simple glory:

RegistryKey regkey = Registry.LocalMachine.OpenSubKey(@”SOFTWAREMicrosoftMSCRM”);
string reportserver = regkey.GetValue(“SQLRSServerURL”).ToString();

And it worked but only just since it uses the server name and my VPN connection to the customers environment didn’t bother with sending it to me why I have to manually add it to the hosts file.

The host file can be found at the path: C:WINDOWSsystem32driversetchosts

and I added the row:

192.168.0.100 CRMTESTSRV

Now my button which point to my aspx that redirects to a the report in pdf-format works just fine and is independant of the CRM server it is installed on.

The solution isn’t supported as far as I know since you never know if they might change the registry value in the future (not very likely in an update but might happen in an upgrade). If anyone has any supported way of getting this URL, please comment this post.

This could also be done using javascripts but I find it easier to manage server side code and it doesn’t add that much overhead considering the report has to be generated independantly of if I use aspx or javascript to open the report.

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica
www.logica.com

How to create a phonecall directly from Outlook

How to create a phonecall directly from Outlook

I am currently working in the early development or late design phases of a project and a few days back, I and my colleague Joakim Westergren were going through the normal sales process and started wondering if there wasn’t an easy way of creating a phonecall activity from Outlook, with the same GUI that you create for instance emails or appointments (by pressing the “Set regarding”-button). After a while, we found it but it wasn’t obvious so I thought you’d might like to know.

You actually create a new Task and then press the lower part of the “Track in CRM” button and select “Phone Call”. The Task is now saved in CRM as a phonecall. Of course you also have to set the “Set Regarding”.

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica Sweden
www.logica.com

Upgrading callouts to CRM 4.0

Hi again,
Busy as ever, I am still working on this large CRM project with lots of integrations. Very complex and very interesting.

At the moment we running CRM 3.0 but we are currently looking at upgrading to CRM 4.0 since we need to implement a new datamodell containing more than 40 very tighly connected entities with multiple relationships, self referentail relationships and much more! We are very lucky to be working with CRM 4.0.

The first part of the upgrade we are doing will be to just get everyting working in CRM 4.0 with as little or no code review as possible. We will lift all the code later (i.e. converting callouts to plug-ins, using the new web service and so on) when we have got everything running.

In other words, I first of all needed to get callouts from CRM 3.0 to work properly in CRM 4.0. After the “sleep-inducing-upgrade”, I found that they simply didn’t work. As I had made a few callouts that generated custom accountnumbers and other similar tasks, it became clear that it crashed because of the callouts.

I activated CRM tracing (http://support.microsoft.com/kb/907490/en-us) and soon found that the reason for the callouts not working was that CRM could not find the dll containing callout.base. So, I added the dll (Microsoft.Crm.Platform.Callout.Base.dll, found on the CRM 3.0 CD 1) to the GAC (C:windowsassembly) and then ran iisreset.

After this, the callouts worked just like they should!

On the same topic, if you have a custom virtual directory bellow the CRM website, just add the file: C:Program FilesMicrosoft CRMCRMWebbinMicrosoft.Crm.WebServices.dll to the GAC aswell, since it won’t work otherwise. There are other ways of getting around this problem aswell, but I prefer this solution.

On the first of may I will be on parental leave for 4 months, so that I can really get to know my daughter without my wife getting in the way! 😉

Hopefully I will have time to write a bit on this blog aswell.

Gustaf Westerlund
Microsoft Dynamics CRM Architect

Logica Sweden
www.logica.com

p.s.
If you havn’t tried Bio Shock on XBOX 360, you really should!

isv.config in CRM 4.0

I recently wanted to add a button in CRM 4.0 and I found that, even though there are many similarirties with CRM 3 there are some differences. I thought I’d share this with you and also some examples of it with a minimal (empty but working) isv.config and a one-button-in-order-version so that it will be easier for you to add your own buttons.

First of all, in CRM 4.0 there is no isv.config in the _resources folder any more. Not very strange since CRM 4.0 is multi-tennant and each tennant can have a unique isv.config. So, where is it? The most obvious place to look for it is in the “export customization” view, and surprise, there it is!

So, to change it in short, select isv.config from the export customizations and press select “export selected customizations” from the action menu. Save the zip-file somewhere, unzip the xml and open it in your favortite xml editor or notepad. When done, just import the xml directly (yes, it supports importing the xml file directly without zipping it first). If you have done your job correctly, there should be no problem, if not, you might get an error. Revert to an older version of the file (always save a backup before doing any changes) and then try a smaller change.

To activate isv.config customizations you have to “enable” these customizations from the web.config in the CRM web folder. Please see the SDK for more info.

To make things easier for you, here is the code in an empty/minimal isv.config (that has worked for me any how). There might be things that can be removed still, to make it smaller. Please leave a comment if you know of any. Please note the lcid:s (language code id:s) that appear all through, as you can see, this is the english version (1033).


<ImportExportXml version=”4.0.0.0″ languagecode=”1033″ generatedBy=”OnPremise”>
<Entities>
</Entities>
<Roles>
</Roles>
<Workflows>
</Workflows>
<IsvConfig>
<configuration version=”3.0.0000.0″>
<Root>
<NavBarAreas>
</NavBarAreas>
<!– The main Global Menu Bar located at the top of all root level areas –>
<MenuBar>
<!– Custom Menus that appear between the Goto Menu and the Help Menu –>
<CustomMenus>
<Menu>
</Menu>
</CustomMenus>
</MenuBar>
<!–
Application Level Tool Bar
–>
</Root>
<!– Microsoft Customer Relationship Management Entities (Objects) –>
<Entities>
<Entity name=”account” />
<Entity name=”contact” />
<Entity name=”lead” />
<Entity name=”opportunity” />
<Entity name=”list” />
<Entity name=”campaign” />
<Entity name=”campaignactivity” />
<Entity name=”campaignresponse” />
<Entity name=”incident” />
<!– Case –>
<Entity name=”quote” />
<Entity name=”salesorder” />
<!– Order –>
<Entity name=”invoice” />
<!– Custom Entities –>
<!– <Entity name=”new_myentity”/> –>
<!– End Custom Entities –>
</Entities>
<!– Microsoft Customer Relationship Management Service Management Customization –>
<ServiceManagement>
<AppointmentBook>
<SmoothScrollLimit>2000</SmoothScrollLimit>
<TimeBlocks>
<!– All CSS Class mapping for Service activities –>
<TimeBlock EntityType=”4214″ StatusCode=”1″ CssClass=”ganttBlockServiceActivityStatus1″ />
<TimeBlock EntityType=”4214″ StatusCode=”2″ CssClass=”ganttBlockServiceActivityStatus2″ />
<TimeBlock EntityType=”4214″ StatusCode=”3″ CssClass=”ganttBlockServiceActivityStatus3″ />
<TimeBlock EntityType=”4214″ StatusCode=”4″ CssClass=”ganttBlockServiceActivityStatus4″ />
<TimeBlock EntityType=”4214″ StatusCode=”6″ CssClass=”ganttBlockServiceActivityStatus6″ />
<TimeBlock EntityType=”4214″ StatusCode=”7″ CssClass=”ganttBlockServiceActivityStatus7″ />
<TimeBlock EntityType=”4214″ StatusCode=”8″ CssClass=”ganttBlockServiceActivityStatus8″ />
<TimeBlock EntityType=”4214″ StatusCode=”9″ CssClass=”ganttBlockServiceActivityStatus9″ />
<TimeBlock EntityType=”4214″ StatusCode=”10″ CssClass=”ganttBlockServiceActivityStatus10″ />
<!– All CSS Class mapping for Appointments –>
<TimeBlock EntityType=”4201″ StatusCode=”1″ CssClass=”ganttBlockAppointmentStatus1″ />
<TimeBlock EntityType=”4201″ StatusCode=”2″ CssClass=”ganttBlockAppointmentStatus2″ />
<TimeBlock EntityType=”4201″ StatusCode=”3″ CssClass=”ganttBlockAppointmentStatus3″ />
<TimeBlock EntityType=”4201″ StatusCode=”4″ CssClass=”ganttBlockAppointmentStatus4″ />
<TimeBlock EntityType=”4201″ StatusCode=”5″ CssClass=”ganttBlockAppointmentStatus5″ />
<TimeBlock EntityType=”4201″ StatusCode=”6″ CssClass=”ganttBlockAppointmentStatus6″ />
</TimeBlocks>
</AppointmentBook>
</ServiceManagement>
</configuration>
</IsvConfig>
<EntityMaps />
<EntityRelationships />
<Languages>
<Language>1033</Language>
<Language>1036</Language>
<Language>1031</Language>
<Language>3082</Language>
<Language>1053</Language>
</Languages>
</ImportExportXml>

And the one containing only one button:

<ImportExportXml version=”4.0.0.0″ languagecode=”1033″ generatedBy=”OnPremise”>
<Entities>
</Entities>
<Roles>
</Roles>
<Workflows>
</Workflows>
<IsvConfig>
<configuration version=”3.0.0000.0″>
<Root>
<NavBarAreas>
</NavBarAreas>
<!– The main Global Menu Bar located at the top of all root level areas –>
<MenuBar>
<!– Custom Menus that appear between the Goto Menu and the Help Menu –>
<CustomMenus>
<Menu>
</Menu>
</CustomMenus>
</MenuBar>
<!–
Application Level Tool Bar
–>
</Root>
<!– Microsoft Customer Relationship Management Entities (Objects) –>
<Entities>
<Entity name=”account” />
<Entity name=”contact” />
<Entity name=”lead” />
<Entity name=”opportunity” />
<Entity name=”list” />
<Entity name=”campaign” />
<Entity name=”campaignactivity” />
<Entity name=”campaignresponse” />
<Entity name=”incident” />
<!– Case –>
<Entity name=”quote” />
<Entity name=”salesorder”>
<MenuBar>
<!– Custom Menus that you may add –>
</MenuBar>
<!– The Account Tool Bar –>
<ToolBar ValidForCreate=”0″ ValidForUpdate=”1″>
<Button Icon=”/_imgs/ico_18_debug.gif” Url=”http://www.microsoft.com” PassParams=”1″ WinParams=”” WinMode=”0″>
<Titles>
<Title LCID=”1033″ Text=”asdf” />
</Titles>
<ToolTips>
<ToolTip LCID=”1033″ Text=”Info on Test” />
</ToolTips>
</Button>
</ToolBar>
<!– The Account Left Nav Bar –>
</Entity>
<!– Order –>
<Entity name=”invoice” />
<!– Custom Entities –>
<!– <Entity name=”new_myentity”/> –>
<!– End Custom Entities –>
</Entities>
<!– Microsoft Customer Relationship Management Service Management Customization –>
<ServiceManagement>
<AppointmentBook>
<SmoothScrollLimit>2000</SmoothScrollLimit>
<TimeBlocks>
<!– All CSS Class mapping for Service activities –>
<TimeBlock EntityType=”4214″ StatusCode=”1″ CssClass=”ganttBlockServiceActivityStatus1″ />
<TimeBlock EntityType=”4214″ StatusCode=”2″ CssClass=”ganttBlockServiceActivityStatus2″ />
<TimeBlock EntityType=”4214″ StatusCode=”3″ CssClass=”ganttBlockServiceActivityStatus3″ />
<TimeBlock EntityType=”4214″ StatusCode=”4″ CssClass=”ganttBlockServiceActivityStatus4″ />
<TimeBlock EntityType=”4214″ StatusCode=”6″ CssClass=”ganttBlockServiceActivityStatus6″ />
<TimeBlock EntityType=”4214″ StatusCode=”7″ CssClass=”ganttBlockServiceActivityStatus7″ />
<TimeBlock EntityType=”4214″ StatusCode=”8″ CssClass=”ganttBlockServiceActivityStatus8″ />
<TimeBlock EntityType=”4214″ StatusCode=”9″ CssClass=”ganttBlockServiceActivityStatus9″ />
<TimeBlock EntityType=”4214″ StatusCode=”10″ CssClass=”ganttBlockServiceActivityStatus10″ />
<!– All CSS Class mapping for Appointments –>
<TimeBlock EntityType=”4201″ StatusCode=”1″ CssClass=”ganttBlockAppointmentStatus1″ />
<TimeBlock EntityType=”4201″ StatusCode=”2″ CssClass=”ganttBlockAppointmentStatus2″ />
<TimeBlock EntityType=”4201″ StatusCode=”3″ CssClass=”ganttBlockAppointmentStatus3″ />
<TimeBlock EntityType=”4201″ StatusCode=”4″ CssClass=”ganttBlockAppointmentStatus4″ />
<TimeBlock EntityType=”4201″ StatusCode=”5″ CssClass=”ganttBlockAppointmentStatus5″ />
<TimeBlock EntityType=”4201″ StatusCode=”6″ CssClass=”ganttBlockAppointmentStatus6″ />
</TimeBlocks>
</AppointmentBook>
</ServiceManagement>
</configuration>
</IsvConfig>
<EntityMaps />
<EntityRelationships />
<Languages>
<Language>1033</Language>
<Language>1036</Language>
<Language>1031</Language>
<Language>3082</Language>
<Language>1053</Language>
</Languages>
</ImportExportXml>

Gustaf Westerlund,
Microsoft Dynamics CRM Architect,
Logica Sweden