Wednesday, July 28, 2010

XRM sdk de-mystified

Well, it has been a while now since the XRM sdk is out and we have been exploring it.

XRM sdk does make programming a lot more easier and most certainly there are a lot fewer lines of code that need to be written.

With the CrmSvUtil tool you can generate the classes for all the custom entities and customizations that you may have added to you CRM system and this allows you to use strongly typed entity classes instead of the use of Dynamic Entities in the earlier version of the SDK. And this then does away with the need to add Web service reference to your applications.

List of customizations supported by the XRM platform.

1. You can develop custom portal applications that run externally and access CRM data.

2. You can develop custom pages that are called from sitemap and ISV from within CRM. For this you need to copy the following files to GAC

Once these files are copied in GAC, your custom pages work just as usual.

3. Support for IFD – In case of pages that were designed to be accessible through CRM IFD access as well, it was earlier required to have the CRM connection created in the context of the impersonator.

Code blocks in this case were executed within the context of “using cmimpersonator()”. The same can be applied for code written using the XRM SDK and these are then available for use in the IFD environment as well.

4. You can use XRM SDK to write code within Workflows as well. The XRMDataContext accepts IWorkflow plugin context as a parameter for establishing CRM connection.

5. However, for reasons knows to MS alone, support for XRM code to be used with plugins has not been provided. This delays the acceptance of XRM sdk as the tool for CRM development.

6. XRM SDK is basically a kind of data layer access to CRM and hence it only provides functionality related to data access such as Create/Update/Delete/Read. It does not support MetaData Service messages.

7. Though it does provide LINQ functionality to read/retrieve data from CRM, it does not match the capabilities provided by the traditional sdk message to retrieve data. We particularly found an issue when reading the display names of lookups or picklist type of attributes that was easily accessible in earlier versions of the SDK.

Given that reading data is an integral part of CRM development I would really appreciate discussion with regards to the above issues noticed.

All said and done… XRM is a great step towards simplifying development, though further improvements might help a great deal. Perhaps it could be our limited understanding of the XRM sdk that might have us believe so. I would like to open the XRM sdk for discussion through this blog for the benefit of the entire community.

Monday, July 26, 2010

Pre-Image & Post Image Explained !

Plugins in Dynamics CRM, allow you to register images against the steps of a plugin assembly. Images are a way to pass the image of the record that is currently being worked upon prior or after the action has been performed. In general it could be said, it is the image of the record as is available in the SQL backend.

Two types of Images are supported, Pre-Image and Post Image.

In case of Pre-image, you get the image of the record as is stored in the SQL database before the CRM Platform action has been performed.
Post Image, returns the image of the record after the CRM Platform action has been performed.

As developers, you may have at times, received the following error when trying to implement a plugin.

It is there important to understand when the images would be available and what state of the record would be returned in these images.

Say you were to register a “Pre-Image” for a plugin registered in Pre-Create Stage. We just mentioned above, that the image is a copy of the record as is stored in the SQL backend. Since this is the create stage and the record has not even been created as yet, there is no record in the SQL backend that can be returned in the Pre-Image and hence any call for the image would fail with the above error message.

The following table explains the Pre-Image Availability

The following table explains the Post-Image Availability

Hope this help demystify the Images..

Thursday, July 22, 2010

How to display fixed number of rows in a table using SRS Report

There are times when you would like to restrict the number of rows that are being displayed on one page in a table. By default if you add a table to a report and set the datasource to a dataset, it will list out all the rows of the dataset in there and if the table data exceeds the report page then it moves to the next page.

Suppose now you want to make sure that there should be note more than 3 rows on each page in the table, you can achieve this by making the following changes to your report.
Say the default query being used to retrieve data is the following

SELECT productdescription, quantity, priceperunit, extendedamount FROM FilteredQuoteDetail

And it will display the following result set.

To fix the rows of the page you need to change the Query to create a custom column in the query that you can use for grouping the rows on a page. Lets call that the page number for each of the record.
We have used the Row_Number() function to group the rows so that there are only 3 rows on each page.

SELECT productdescription, quantity, priceperunit, extendedamount, page = (CASE WHEN (Row_Number()
OVER (ORDER BY productdescription) % 3 = 0) THEN (Row_Number() OVER (ORDER BY productdescription) / 3) - 1 ELSE (Row_Number() OVER (ORDER BY productdescription)
/ 3) END)
FROM FilteredQuoteDetail

It displays the following result set.

Now you need to add the list the on the report page and Group this list by the page column as shown in the below screenshot.

Now add the table under this list. As shown in the below screenshot.

Now you run this report then data display in 2 pages.

There you are!!!

Thursday, July 15, 2010

How to activate contract in CRM

When a new contract is created in CRM, it is in the Draft state and cannot be utilized to assign a case against it.

For a contract to be available, it must be activated. A contract is automatically activated by CRM if the following conditions have been met.
1. There must be contract lines added to the contract.

2. The contract should be invoiced. You can invoice a contract from the actions menu as is shown below
3. Once the above two conditions have been taken care of, the contract status would automatically activate once, the system date matches the contract start date Hope this solves the mystery about activating a contract. Just like a contract is activated, the contract is de-activated automatically by CRM once the contract end date passes.

Monday, July 12, 2010

Working of Announcement

Dynamics CRM provides feature to create announcement that can be broadcast to the entire organization. it can be viewable by the entire organization if the users have been given the permission to read the Announcements.
How to create the announcements

1. In the Navigation Pane, click Settings, click Administration, and then click Announcements.
2. On the Actions toolbar, click New.
3. On the Announcement tab, enter information or observe any noted restrictions or requirements as needed:
• Title
Enter a title that clearly and unambiguously describes the nature and purpose of the announcement.
• Body
Enter the entire text of the announcement. You can cut and paste an announcement text from another application. However, any formatting will be lost.
• More Information URL
Enter a Web address path for a Web site with more details related to the announcement. A Web address that does not include "http://" is automatically expanded to a full Web address.
In the announcement, the Web address is an active external link.
• Expiration Date
Enter the expiration date for the announcement, or click the Select Date button to select the date.
When an announcement expires, its expiration date cannot be updated. Microsoft Dynamics CRM removes it from the Announcements area, and you must create a new announcement.
4. Click Save or Save and Close.
As shown in the below screenshot.

After creating the announcements user can see these announcements under the Workplace then Announcements as shown in the below screenshot.

It is the good functionality to exchange the information and User’s communication in the organization. Announcements work like message boards where users can post topics of interest that they wish to share with all the other users of CRM.