Friday, October 30, 2009

Adding tooltips to attributes on CRM Form






I had been looking for the best method to implement tooltips feature in CRM Form log ago. I found a lot of solutions on internet but they never satisfied my requirements. Some are using of complicated java script functions, some are using their own created wizards and some are using web service to retrieve descriptions of attribute to display as tooltip on form.

Today, I found an easy way to do that. The original idea comes from Marcello Tonarelli. But, I changed a little bit on his original code.

//Original Script
crmForm.all.birthdate_c.title = "Please choose date of birth"; 
crmForm.all.birthdate_d.title = "Please choose date of birth";

Reference:
Marcello Tonarelli

How to add syntax highlight in your blog post

This following links will help you to explain how to add syntax highlight in your blog post.

Reference:
SyntaxHighlighter
How to add syntax highlight to blogger

Thursday, October 29, 2009

Collapsible Sections on CRM Forms




Very nice and impressive feature.
Thanks Marco Amoedo.You really save my life :-)


function getElementsByCondition(condition, container) {
    container = container || document;
    var all = container.all || container.getElementsByTagName('*');
    var arr = [];
    for (var k = 0; k < all.length; k++) {
        var elm = all[k];
        if (condition(elm, k))
            arr[arr.length] = elm;
    }
    return arr;
}

function attachCollapsableToSections() {
    var sections = getElementsByCondition(function (elm) { if (elm.className.indexOf("ms-crm-Form-Section") != -1) return true; }, null);

    for (var i = 0; i < sections.length; i++) {

        sections[i].innerHTML = 'Expanded, click to collapse' + sections[i].innerHTML;
        sections[i].childNodes[0].attachEvent('onclick', toggleVisibility);
    }

}

function toggleVisibility(e) {
    var sectionContainer = e.srcElement.parentNode.parentNode.parentNode;
    var elements = getElementsByCondition(function (elm) { if (elm.vAlign == "top") return true; }, sectionContainer);

    for (var i = 0; i < elements.length; i++) {
        if (elements[i].style.display == "none") {
            elements[i].style.display = "";            
            e.srcElement.src = e.srcElement.src.replace("navdown", "navup");
        }
        else {
            elements[i].style.display = "none";            
            e.srcElement.src = e.srcElement.src.replace("navup", "navdown"); 
        }
    }
}

//Example of utilization
attachCollapsableToSections();
Reference: El del CRM

Wednesday, October 28, 2009

Custom Warning Message on CRM Form





Very nice and impressive notification method.

addNotification = function(message) {

    var notificationHTML = '<DIV class="Notification"><TABLE cellSpacing="0" cellPadding="0"><TBODY><TR><TD vAlign="top"><IMG class="ms-crm-Lookup-Item" alt="" src="/_imgs/error/notif_icn_crit16.png" /></TD><TD><SPAN>' + message + '</SPAN></TD></TR></TBODY></TABLE></DIV>';

    var notificationsArea = document.getElementById('Notifications');
    if (notificationsArea == null) return;

    notificationsArea.innerHTML += notificationHTML;
    notificationsArea.style.display = 'block';
}

//Example of utilizations
addNotification('Some warning message that you want to show to the user ');

Reference:
El del CRM
Dynamics CRM Tools

Sunday, October 25, 2009

XrmVisioER: Metadata Diagram Generator

Since CRM entities are composed of TWO SQL tables (i.e; extension and extension based), it is very time consuming for developers to draw an ER diagrams for each entity. If we used ER Diagram generators in the market, the diagrams they generated become very complex and it will not be easy to understand by users when they try read it.

That's why, Microsoft came out with a very useful Metadata diagram generator (CRM ER Diagram Generator) which we can find under CRM SDK samples. But, I still feel that the program is quite difficult to use for beginners since it is written in console application mode and can be run only from server (if you do not know how to change server URL in program).

This weekend, I re-modal the whole program to provide following functions for CRM developers:
  • Allow program to run from anywhere (no need to reside in server)
  • Ask users to choose which entities they want to generate diagram and where to save them
  • Allow each ER diagram to save in separate pages within one MS Visio file
  • Allow users to customize exclusion entities and relationships when they generate diagram


System Requirements:
  • .NET Framework 2.0
  • Microsoft Visio

Feel free to use this application.
Either leave comment or email me if you want to know further information.
---------------
Revised version can be found here.

Saturday, October 24, 2009

XRM Virtual User Group Membership Drive Contest Award

Yesterday, I won TOP 5 Membership Drive Contest Award at XRM Virtual User Group. I received an XRM SDK license plus a 5 user XRM Extensions license complete with a full year of maintenance from Shan McArthur at ADXSTUDIO.

I would like to say thanks to Shan McArthur, xRM Virtual User Group and my colleagues at PulseSync for their support and giving me a great chance to explore more on MS xRM development platform.

Hello Thuta,

Congratulations, you are one of the top-5 winners of the XRM Virtual User Group membership drive. This prize includes on year’s subscription for a single developer for ADXSTUDIO XRM SDK plus a 5-user license of ADXSTUDIO XRM Extensions. This includes one year of maintenance for both products. Thank you so much for making this membership drive successful!

Product download link
Product demonstration videos

If you have any questions about the product or you license rights, please feel free to contact me or post on the community forums at http://community.adxstudio.com/forums/xrm

Thanks,

Shan McArthur – VP, Technology (Microsoft Dynamics CRM MVP)

Thursday, October 22, 2009

FileHelpers Library 2.0

Very useful tool to extract and create flat files based on strong type record structure
The FileHelpers are a free and easy to use .NET library to import/export data from fixed length or delimited records in files, strings or streams.

You can strong type your flat file (fixed or delimited) simply describing a class that maps to each record and later read/write your file as an strong typed .NET array. The Library also has support for import/export data from differents storages like Excel, Access, SqlServer, etc.
Reference:
FileHelpers Library 2.0

Reporting Services Scripter (RSScripter)

Very useful tools to deploy reports across reporting servers
Reporting Services Scripter is a .NET Windows Forms application that enables scripting and transfer of all Microsoft SQL Server Reporting Services catalog items to aid in transferring them from one server to another. It can also be used to easily move items on mass from one Reporting Services folder to another on the same server.

Depending on the scripting options chosen, Reporting Services Scripter can also transfer all catalog item properties such as Descriptions, History options, Execution options (including report specific and shared schedules), Subscriptions (normal and data driven) and server side report parameters.
Reference:
Reporting Services Scripter
Download Link

Wednesday, October 21, 2009

Get all child business units by level based on specified BU id

To retrieve all child business units by level based on specified business unit id:

ALTER FUNCTION [dbo].[f_GetAllBusinessUnitByID]
(    
    @BUID VARCHAR(MAX)
)
RETURNS TABLE 
AS
RETURN 
(
    WITH BUTree(ParentBusinessUnitId, BusinessUnitId, Name, Level)
    AS
    (
        -- Anchor member definition
        SELECT P.ParentBusinessUnitId, P.BusinessUnitId, 

               P.Name, 0 AS Level
        FROM BusinessUnit AS P
        WHERE P.BusinessUnitId = @BUID

        UNION ALL

        -- Recursive member definition
        SELECT P.ParentBusinessUnitId, P.BusinessUnitId, 

               P.Name, Level + 1
        FROM BusinessUnit AS P
        INNER JOIN BUTree AS B
            ON P.ParentBusinessUnitId = B.BusinessUnitId
    )

    -- Query All Child Node
    SELECT C.ParentBusinessUnitId, C.BusinessUnitId, 

           C.Name, C.Level
    FROM  BUTree C
    WHERE C.BusinessUnitId NOT IN 

          (SELECT ParentBusinessUnitId 
           FROM   BUTree
           WHERE  ParentBusinessUnitId IS NOT NULL)
)

Sunday, October 18, 2009

SQL performance WITH (NOLOCK)

A few months ago, we started UAT for our application development and found out that some statistical SRS reports were running very slow. After debugging and done performance tuning steps, we noticed that those reports were running very slow when a lot of concurrent users accessing the same tables and/or views that the reports were referencing.

After surfing through Google, we found out a hint called NOLOCK.
SELECT au_lname FROM authors WITH (NOLOCK)
NOLOCK does not issue shared locks and do not honor exclusive locks. When this option is in effect, it is possible to read an uncommitted transaction or a set of pages that are rolled back in the middle of a read. Dirty reads are possible. Only applies to the SELECT statement.
We changed most of the SELECT statements with NOLOCK and performance of statistical reports became very must faster. Query execution time which took around 45 minutes previously became around 6 minutes plus.

But there were some pros and cons of using NOLOCK in SELECT query. Below is the comment made by Lumbago on SQL Team forum.
NOLOCK will cause your selects to read dirty data and I have prevoiusly said that I belive this is perfectly acceptable in over 80% of the queries I have worked with over the years, and I still belive this is true. It will reduce locking in your database and increase performance of your queries.

HOWEVER, it is absolutely essential that you know how it works and you need to think well through where to use it and not. It could cause severe inconsistencies in your database if not used properly and you should never use it in any insert/update operations. The general advice is that if you're not 100% sure it's ok to read the dirty data, then don't use NOLOCK.

Reference:
Lumbago
MSDN: Locking Hints
SQL Server NOLOCK / ROWLOCK Directives To Improve Performance

Friday, October 16, 2009

What is xRM?

You do not have the Flash plugin installed to view the file correctly. You may download the plugin from here: http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash

There are a couple of different definitions for XRM. One is that the “x” stands for extended, as in extended relationship management. The other definition is that the “x” is a variable, and means “anything” relationship management, such as partner relationship management, constituent relationship management, employee relationship management, etc.

Both of these definitions are referring to building any application on top of the Microsoft Dynamics CRM platform. Building an XRM application can take the form of customizing the existing customer relationship management applications that are included in Microsoft Dynamics CRM, or by designing completely new line-of-business applications that are not based on the sales, service, or marketing capabilities included in Microsoft Dynamics CRM.

The common thread to all the definitions of XRM and methods of extending it is that your application will use the Microsoft Dynamics CRM as a platform, leveraging the capabilities of the platform to deliver business value to your users.

Reference:
An Introduction to XRM for a .Net Developer
credit goes to original uploader@YouTube

hug a developer today

You do not have the Flash plugin installed to view the file correctly. You may download the plugin from here: http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash

credit goes to original uploader