Wednesday, October 19, 2011

CRM 4.0 migration to CRM 2011

Backup CRM 4.0 SQL Server database

1. Open SQL Studio Manager
2. Connect to CRM 4.0 database
3. Expand Databases
4. Right-click on xxxxxx_MSCRM database, Tasks -> Back Up
5. Back Up to Disk (dbname.bak)

Restore CRM 4.0 database in CRM 2011 SQL Server

1. Open SQL Studio Manager
2. Connect to CRM 2011 database
3. Right-click on Databases, Restore Database
4. To Database - type in new crm database name, From Disk - select backup you created (dbname.bak) from CRM 4.0 SQL Server

Import new database with CRM 2011 Deployment Manager

1. Run CRM 2011 Deployment Manager (Start->All Programs->Microsoft Dynamics CRM->Deployment Manager)
2. Organizations -> Import Organization
3. Select database you restored in CRM 2011 SQL Server
4. Type in Display name and Unique Database Name (of your choice)
5. Type in CRM 2011 Report Server URL
6. Select "Automatically Map Users" (if you are in the same domain)
7. If some user doesn't exist in new CRM 2011 you can create them in Active Directory and then map them or just ignore this and go further.
8. System checks all prerequisites for Import.
9. *.If there are no errors you can click Import (Import can take up to some hours, depending on your db size and customizations etc).

*. If you see warning "Fragmented indexes were detected in the Microsoft Dynamics CRM database", you can ignore this message and go further but i would suggest you to do following as it greatly can impact the overall import process time: This error message says that there are fragmented indexes. To rebuild these indexes you can use this link: (In Russian)
1. Download all 3 files from this link above (IndexOptimize.sql, CommandExecute.sql, DatabaseSelect.sql)
2. Open them via SQL Studio Manager and execute them: At very begining of each script add these two lines to select your CRM 4.0 database for creating these stored procedures -
   USE <xxxxx_MSCRM>

3. And finally run this script to rebuild indexes:
   EXECUTE dbo.IndexOptimize @Databases = 'orgname_MSCRM',
    @FragmentationMedium = 'INDEX_REORGANIZE',
    @FragmentationLow = NULL

4. And then proceed with Import.

Monday, July 25, 2011

Sharepoint 2010 Server install Step By Step

In my previous post Sharepoint 2010 Foundation Install Step By Step we went through the steps to install SharePoint 2010 Foundation, so this time we will go through SharePoint Server 2010 installation process.

there is practically no difference between SPF 2010 & SPS2010 installation, except of some new error messages :)

So here we go

Thursday, July 7, 2011

CRM email with pdf report attachment

1.step: In Visual Studio creating new WORKFLOW ACTIVITY LIBRARY
2.step: Add references Microsoft.Crm.Sdk, Microsoft.Crm.SdkTypeProxy;
3.step: Add web reference http://<reportservername>/ReportServer/ReportExecution2005.asmx
4.step: Debug this code
5.step: Run Plugin Registration Tool and register new assembly (that will be dll created from this source in path where this project will be created in bin folder)
6.step: Create new Workflow in crm with this custom workflow activity as new step

And here goes full code:

Wednesday, May 25, 2011

CRM in FireFox

If your preferred browser is not IE.. :) then there is great solution to work with Microsoft Dynamics CRM in Mozilla FireFox - "IE TAB" Add-on.

To use this add-on:
1. download add-on
2. restart FireFox
3. Tools -> IE Tab 2 options
4. Add your CRM site url to "Sites Filter" section

That's it, CRM in FireFox

Wednesday, May 18, 2011

CRM FetchXml with Javascript

FetchXML method using javascript in CRM, allows me to use linked entities, so I can query attributes from different tables and linke them together with some primary attribute. 

Here's example:

// Prepare variables
var fetchMapping = "logical";
var entityName = "entitiyname";
//first attribute to fetch from this entity [CHANGE THIS]
var FirstColumn = "attributename1"; //first attribute to fetch from this entity [CHANGE THIS]
var SecondColumn = "attributename2"; //second attribute to fetch from this entity [CHANGE THIS]
var ThirdColumn = "attributename3"; //third attribute to fetch from this entity [CHANGE THIS]

Tuesday, May 17, 2011

Sharepoint Query with SPAPI

1. To use SPAPI query download it from HERE!!!.
2. On SharePoint server under "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS" create folder "SPAPI".
3. Place extracted js files from download to this folder.
4. Put your query within these code lines: 

<script type="text/javascript" src="/_layouts/SPAPI/SPAPI_Core.js"></script>
<script type="text/javascript" src="/_layouts/SPAPI/SPAPI_Lists.js"></script>
<script type="text/javascript">

<your spapi query>


//SPAPI query example:

Monday, April 11, 2011

SharePoint Workflow does not start automatically (kb947284)

I was able to start my workflow automatically which I created through SharePoint Designer. 

Firstly I checked out instructions from this article kb947284. In my case regarding to kb947284 I was logged in with "System Account". So I took some other user from sharepoint member group and logged back in, but with no luck...

After hours of endless searching i came across to something like this: "If I browse my sharepoint web page with IP address instead of hostname automatic workflows wouldn't start!!!"

Friday, April 1, 2011

Sharepoint 2010 Foundation install Step By Step

My goal was to install Sharepoint Foundation 2010 (SPF2010) so that web application is on one server and the database is on seperate server.

So these were my steps:

Tuesday, March 29, 2011

Latest earthquakes in the World

Very usefull online information tool to get info for latest earthquakes and volcanos in the world

Monday, March 28, 2011

How long does it take to drive through Riga city ?

I must say that this is not a story about THIS. My approach was more realistic and much safer :)I took my car to drive through city Riga from one city border to another simply to check how much time do i need to get through this city within legal limits.

Thursday, March 24, 2011

Get current SharePoint User with JavaScript

During the SharePoint form customization in many cases it is important to know the current user. So with JavaScript and SharePoint Designer this is how it's done:

var loginElement = document.getElementById("zz7_Menu").innerHTML;
var end = loginElement.indexOf("<");
var nameOnly = loginElement.substring(8, end);

note: I use this script in MOSS2007, but if you use this in WSS3 change "zz7_Menu" to "zz6_Menu".

My whole point using this script was to get the current username (in my case organization username format is: username14, username57 etc.) And based on that I need to get only numbers from this username. So there is my complete solution:

var loginElement = document.getElementById("zz7_Menu").innerHTML;
var end = loginElement.indexOf("<");
var nameOnly = loginElement.substring(8, end);
var number = nameOnly.replace (/[^\d]/g, "");
var k;

if (number != "") {
var elements = document.getElementsByTagName('select');
for (var i = 0; i < elements.length; i++) {
if (elements[i].title == 'YOUR DROPDOWN TITLE'){
var sel = elements[i].options.selectedIndex = number;
for (k=elements[i].options.length-1;k>=0;k--) {
if (k != sel) {


Tuesday, March 22, 2011

How to get CRM grid View Id

If we add this piece of code to ISV.config we get the current View Id currently displayed in the CRM grid:

if (top.stage.crmGrid != null)
    var ViewID = top.stage.crmGrid.GetParameter('viewid');    


Train Tracking with GPS

Last Saturday I took a trip on a train from Riga to Saulkrasti (45km). Weather was pretty cloudy but I thought maybe I could get interesting info from this trip with my gps. This is my gps data report

Train model: ER2T

Friday, March 18, 2011

CRM Save Events - you can do more

    When user saves the form we can check which save event was executed and regarding to that event make some actions. Two most popular save events are Save and SaveAndClose.

Javascript functions to call from  your script:

To check which event was executed  we use "event.Mode"
Output for Save event = 1;
Output for SaveAndClose event = 2;

if  (event.Mode == 1) {
alert("You click Save button");
} else if (event.Mode == 2) {
alert("You click SaveAndClose button");

Thursday, March 17, 2011

JavaScript in CRM ISV.config

Writing JavaScript code in ISV.config can be painful. There is one important thing you need to know when you write JS code in ISV - Some JavaScript characters here are not supported and that's why you need to encode them:

Symbol                 Encoded value
   <                       &lt;    
   >                       &gt;
   "                       &quot;
   &                       &amp;

Wednesday, March 16, 2011

Great site for CRM developers

If you are familiar with Russian language this is great site about CRM customization. If not.. there still are lot of scripts to pick up.
Мелкомягкий CRM