Monday, March 21, 2011

Reporting through BIDS in CRM Online 2011

In the CRM 2011 online if you want to create your custom SSRS report then here is the trouble, you cannot create the report directly using the SQL Queries as you do not have access to SQL Server. For this reason MS has provided BIDS tool for Dynamics CRM 2011. You can download this tool from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=64a09b75-8376-4b9d-aea3-8a83a1837c4d

Using the BIDS tool, you can connect to Dynamics CRM Online service and use the CRM FetchXML queries to generate the queries required for the report.

To create the SSRS report for the CRM 2011 Online first you need to run the tool “CRM2011-Bids-ENU-i386” on the machine where you have installed the SQL Server Business Intelligence Development Studio.

After installing this, a new Data Source type gets added in the “Embedded connection type” option named “Microsoft Dynamics CRM Fetch”. To create the new report with fetch XML for the CRM 2011 you need to select this data type as shown in the below screenshot.

In the Connection string you need to provide your CRM 2011 online url and the org unique name, where the org unique name is optional and in the permissions section you need to provide the credentials of the CRM user.

In the SSRS report the main things are the Parameters, Query/Dataset and Design. Below is the explanation.

Parameters: You can simply defined the parameter as it is, but if you want to use the CRM filtered parameter and show this reports on the CRM grid or on the selected record, then you need to use the enableprefiltering in the fetchXML of this parameter. You can write the default fetchXML for this as follows.

Query/Dataset: Main thing in the Query is to pass the condition from the parameters. Generally in report the structure is that you have main-report and a sub-report, where you pass the parameter values of the main-report to the parameter of the sub-report.

Here we take an example to understand how it works in this scenario. For example: suppose we want to see all the contacts that is modified by a certain user, we want to run this report on the CRM user form and see the list of contacts.

For this purpose, we have created a Main report where we have a parameter named “@CRM_FilteredSystemuser” which is passed from CRM and it creates a dataset from this Parameter with three columns.
Fullname
Internamemailaddress
Systemuserid


The query for this dataset is shown in the above screenshot.
Note: If you have used the CRM parameter then it should be hidden.

Now we need to create the sub-report which contains the list of the contacts, in the sub-report we have a parameter named @Userid, and the value for this parameter is passed from the Main Report. Now the Query for sub-report with condition is as shown below.


Once you execute the Query, the dataset will be generated. From there on you can go ahead and design the report like any other normal SSRS report.

Once designed, you can upload this report to CRM and run it through the CRM User entity form.

Through BIDS it is now really easy to design reports for CRM Online 2011. Good knowledge of FetchXML is required. However there are tools available that would let you convert/design FetchXML queries through Query designer interface.

Monday, March 7, 2011

Use of Web Resources in CRM 2011

With CRM 2011, you now have the concept of including resources within CRM that can they be used to display on CRM forms in IFRAMES and buttons and other customizable objects in CRM.

A web resource in CRM can be any of the following


Here we take an example of adding a custom html page that requires supporting javascript and images for it to work.

When you would have designed the page, there are chances that you have created a directory structure where the htm page would be in the root directory but the images would be in a folder called _img and scripts in a folder called scripts within the root directory.

To upload this entire application as resource within CRM, you will need to individually upload all of the files related to the application. However, what you need to take care is the way you name these resources in CRM while uploading. You can create a virtual directory structure by including the path in the name of the resource.

In case of our above example, the resources would be named as follows to represent the same directory structure

Suppose if you have created the following web resources.
1. New_/IMG/My.GIF
2. New_/Script/My.js

Now if you are going to use these webresources in the html web resource and the html web resource name is “new_/Pages/TestHtmlPage.html”.
Then you need to give the name as follows, because CRM takes the name as the virtual folder. Hence your script files exist in the Script folder and Html page exist in the Pages folder hence when you add the resources in your html page then first you come out from the “Pages” folder and then you give the path for the js file hence the src will be “../Script/My.js”.
< SCRIPT src=” ../Script/My.js” type =text/javascript>

Say you are developing an htm page from which you are going to create an account in CRM or need to access the controls placed on the CRM entity form, you will need to add the reference to the following script library and also ensure that you have uploaded this as a resource in CRM as well.
Once the resources have been added in CRM, you can now access them in CRM through IFRAME.


Tuesday, March 1, 2011

Addresses in CRM explained....


We recently came across a request for data correction where the customer had lost some of their address data. No addresses were displayed on the Account form. One would think all that was corrupt was the address and having them type in the address on the form should do the trick. But no, with the address missing even when they tried to manually re-enter the address in these records, they were unable to, it would throw an error. That’s when we found out the following

When you open an Account, you are presented with a set of fields for storing address. If you check the CRM account entity details, you will find there are actually two sets of address fields available. By default only address_1 set of fields are placed on the form, but you can also add the second set of address_2 fields.

Besides this we are also provided with the option to add multiple other addresses under the More Addresses section on the account form.

Common perception of this design would be that 2 default set of address fields have been added on the account entity for ease of access and use. They have the Customer Address entity to store the more addresses associated with the Account.

We just happened to find out that this is not really the case. All addresses are only stored in the Customer Address entity.

When you create a new account/contact, it would by default in the background add 2 entries in the Customer Address entity for the 2 set of address fields available on the Account form. CRM distinguishes these entries from the rest of the entries to be displayed in More addresses using the Address number column. Address number 1 and 2 are reserved for the 2 set of address fields available on the account form.

The reference to these is stored in the Account entity schema using the address1_addressid and address2_addressid.


Hope this would help someone out there understand the technical concept of addresses much better from now on

Saturday, February 19, 2011

Difference between CRM 4.0 and CRM2011 script for using on form customization

When working with CRM2011 Java script we found many difference about syntax/methods between CRM2011 and CRM4.0 Please check some of the comparisions we have listed. Please click on the Image below to enlarge view.

Monday, February 14, 2011

Create and Update events for the appointment entity

You will notice that if you register a plugin on the Create or Update event of an appointment in the Parent Pipeline, the plugins do not fire. When you create an appointment in CRM it is set to the status of “Scheduled” implying an appointment has been scheduled.



To trap create and update of Appointment through CRM you need to trap the Book Request and Reschedule request respectively.



When you run the diagnostic tool you would find that the Book Request is fired. It will show up the following xml.