Tag Archive for CRM Tool of the Week

SVN Tools – Getting Started with Source Control

This week we are going back to basics and talking about an important topic for any type of developer, Source Control Management.

What is SVN?

SVN is a common abbreviation used by programmers for Subversion. It is a repository where code and other files can be stored. Both the current version as well as historical copies of previous versions are stored within this repository.

Basic SVN Commands

  • Add
  • Checking Out
  • Update
  • Commit

When you start out with SVN you will need to use the “Add” command to create a new folder or “Add” a file. If you are working with an existing repository, you can use the “Check Out” command to make your own copy of a folder from SVN. If changes are made to the SVN folder after you check it out you can use the “Update” command to sync your local copy of the folder with what is now in SVN. After you have made your changes you will want to check them back into SVN using the “Commit” command.

Commit Small and Often

When you start out with SVN it is easy to get into the habit of checking in all of you code changes at once. If you lump all of your days or weeks changes together it makes it much harder to manage the code. To get the most out of SVN you will want to check in smaller more logical chunks of code. If you make a bug fix in the code check that individual bug fix in with its own commit, don’t let your changes build up.

Advanced SVN Commands

  • Branch – Creates a copy of a
  • Merge
  • Diff

SVN is more than just a backup system for your files. It allows a team or a single developer to track and manage changes they have made to the code base. You can create copies or “Branches” of your project, allowing you to develop and test new features before intergrating or “Merging” them back into your main code or “Trunk”. Multiple branches are supported so developers can independently work on adding features to the same project. When your changes are ready to be merged back into the trunk you can view all of the changes between two versions of the code using the “Diff” feature.

SVN Software

There are a number of SVN servers and even more clients. Here is a SVN Server and Client that I recommend you give a try if you are new to SVN.

If you are working with a team, you will want to check what software they may already be using. As you would not want to setup another SVN environment, if there is already one in use.

VisualSVN – SVN Server

Visual SVN is an easy to use and fully functional SVN server built for the Windows Platform.

Visual SVN Server is available at http://www.visualsvn.com/server/ . Once you have downloaded and installed the Visual SVN Server check out the Getting Started section of their website for details on configuring your SVN Server.

TortoiseSVN – SVN Client

TortoiseSVN is an easy to use SVN Client for Windows machines. It gives you a nice UI so you don’t have to be typing out commands. It even hooks into the file explorer, so you can quickly check in changes.

TortoiseSVN is available at http://tortoisesvn.net/ .

Here is a quick video to get you started with TortoiseSVN.

For more information on using TortoiseSVN Client check out the tutorial at http://www.igorexchange.com/node/87 .

Other Flavors of Source Control

SVN is not your only choice for version control like Mercurial, CSV or Perforce. A couple of note for CRM Developers are:

Team Foundation Server (TFS)

As many Dynamics CRM Developers work for Microsoft Shops, a talk about source control would not be completed without mentioning Microsoft’s application lifecycle management solution called Team Foundation Server (TFS). TFS is more than just source code management and includes Work Item Tracking, Build Automation, Reporting and Project Management.

If you are looking to create a collaborative and agile team you should take a look at implementing Team Foundation Server.

TFS is not a quick install and your done deal, it is a change in the way of life for your developers, testers and project managers. You wouldn’t just install CRM for a sales team and walk away thinking that they will suddenly become this well oiled sale closing machine because you have installed a great program for them to use. There is a lot of up front time investment to get your team off the ground with TFS, but the investment can payoff in the long run.

GIT

Unlike most other source code management systems GIT creates a local repository on your machine. As needed you can update your repository by “pulling” down the latest version from a remote repository. If you have changes you would like to have added to the remote repository you can “Push” them up to the server. This pushing and pulling concept has made GIT widely used with the Open Source Community.

With other source control systems you are connecting directly with a central repository server every time you check code out or commit changes. This can be a problem if you are disconnected from the network. If you spend the day out of the office working on your laptop you have to wait until you get an internet connection before you can check in your changes.

You can download GIT through http://git-scm.com/ . Their site also has some great information in the Documentation section to get you started with GIT and source control.

GitHub

GitHub is a hosting provider for GIT repositories. They offer free hosting for Open Source projects, and you will find that many open source projects have taken them up on this offer.

The recently released a windows client, which you can download from http://windows.github.com/ . As an added bonus the client is built using the Metro UI, so

 

 

CRM Tool of the Week – CrmFetchKit.js

Last weeks Tool was the Custom Code Validation Tool which helps you identify unsupported code in your form scripts.  Keeping with the theme of preparing for Q2 2012 service update for Microsoft Dynamics CRM 2011 (R8) and cross browser support this weeks Tool of the Week is the CrmFetchKit.js . This JavaScript library will help you fix some of your unsupported code you may have found.

FetchXML and Cross Browser Support

One of the many differences between the different browsers is how they handle parsing through xml nodes or xml-traversing. A method that was used in some old form scripts for fetching data from CRM was the selectSingleNode. However, selectSingleNode is only supported in IE.

There is a good chance that any of your old FetchXML form scripts are not cross-browser compatible. If so you will want to update these scripts to use a javascript library like JQuery, which has great cross-browser support, to handle the XML traversing. That’s where the CRMFetchKit.js comes in.

The CRMFetchKit.js is built on top of JQuery and lets you easily get the results from a FetchXML query in your form scripts.

Fetch

The following shows a Basic Fetch using the CrmFetchkit.js

var fetchxml = ['<fetch version="1.0" output-format="xml-platform" mapping="logical">',
                ' <entity name="account">',
                ' <attribute name="name" />',
                ' <attribute name="accountid" />',
                ' <filter type="and">',
                ' <condition attribute="name" operator="eq" value="test" />',
                ' </filter>',
                ' </entity>',
                '</fetch>'].join('');

// Action: load the account with a certain name
CrmFetchKit.Fetch(fetchxml).then(function (results) {
    /* success handler */

}, onFetchError);

 

FetchMore 

The Fetch More method can be used for retrieving datasets. It includes a flag for more records.

The following shows a FetchMore using the CrmFetchkit.js. If there are more than 10 contacts with a last name like test% than response.moreRecords will be true.

var fetchxml = ['<fetch version="1.0" output-format="xml-platform" ',
                        'mapping="logical" ',
                        'returntotalrecordcount="true" ',
                        'count="10">',
                ' <entity name="contact">',
                ' <attribute name="lastname" />',
                ' <attribute name="contactid" />',
                ' <filter type="and">',
                ' <condition attribute="lastname" operator="like" value="test%" />',
                ' </filter>',
                ' </entity>',
                '</fetch>'].join('');

CrmFetchKit.FetchMore(fetchxml).then(function (response) {

    // get the logic-entity name
    var entityname = response.entityName;

    // the requires 'returntotalrecordcount="true" ' to be defined in the fetchxml
    var total = response.moreRecords;

    // get the entities as array
    var set = response.entities;

    // the page-cookie is required for paging
    var pageCookie = response.pagingCookie;

}, onFetchError);

FetchAll

The FetchAll method can be used for retrieving results from large datasets that exceed 5,000 records.

The following shows Fetch All using the CrmFetchkit.js

var fetchxml = ['<fetch version="1.0" output-format="xml-platform" ',
                        'mapping="logical" ',
                        'count="10">',
                ' <entity name="contact">',
                ' <attribute name="lastname" />',
                ' <attribute name="contactid" />',
                ' <filter type="and">',
                ' <condition attribute="lastname" operator="like" value="test%" />',
                ' </filter>',
                ' </entity>',
                '</fetch>'].join('');

CrmFetchKit.FetchAll(fetchxml).then(function (entities) {

    /* success-handler */

}, onFetchError);

What Else Can it Do?

In addition to Fetching results the CrmFetchKit.js can also assign records!

CrmFetchKit.Assign(recordid, 'entity', userid)

Download

You can download the CrmFetchKit.js from CodePlex

Setup

To use the CrmFetchKit.js you will need to create a new web resource and upload the CrmFetchKit.js file to it. You will also need to Download JQuery and create a web resource for JQuery. Make sure that you add both of these web resources to any forms you will be setting up FetchXML form scripts on.

You can then create form scripts based off of the sample code to Fetch data from CRM.

The following shows a basic fetch using the CrmFetchkit.js

CRM Tool of the Week – Global Search

Have you ever trouble finding a person in CRM, only to find that they were not showing up in your search results because they are a Lead and not a Contact?

I have used other CRM systems which let you search across multiple entities and have always felt that this was an important feature missing from CRM 2011. I am glad to see that Sonoma Partners has created a product that will add this feature to CRM. As you would expect from Sonoma Partners the product integrates nicely within CRM, adding a Global Search box to the Ribbon throughout CRM. The Search is also customizable so an administrator can control what Entitys are available for users to search against.

Check out this video on CRM 2011 Global Search to see it in action.

For more information on Global Search Contact Sonoma Partners.