Tag Archives: Tips & Tricks

CRM Mail Merge Letter Printing Issues

Today we came across interesting problem regarding mail merge letter with regards to Dynamics CRM.

We were generating customer letter from Dynamics CRM Mail merge.

Our letter was four page letter and we had mail merge template setup and letter generated fine.

But while printing we wanted to print first page of company letter pad and other one on normal page. Well if you just print the mail merge generated letters then it consider the entire letter as one document and print them in just one print job.

So we used to get only first page of first letter on company letter page while others are printing normally which is not correct…

Well after much investigation (or should I say trial and error method) we found the solution and following steps to achieve the same..

1. Open Relevant word Document or Letter
2. Alt + F11 to open the Visual Basic Editor.
3. Module -> Insert Module
4. Copy following code and past in there…

Option Explicit
Sub PrintSectionsToSubDoc()
Dim i As Long
For i = 1 To ActiveDocument.Sections.Count
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i
End Sub

5. Close the Visual Basic Editor

6. Go to View -> Macros (or Tool-> Macro -> Macros for Office 2K3 ) and double click PrintSectionsToSubDoc()

Mayank 🙂


CRM Sales Order: where is mail merge?

This one just struck me that when creating new mail merge template Sales Order does not appear as entity in the list…

Following article will help you enable mail merge of any CRM entity.

Again note that this is unsupported way to add this sales order entity in to the list as mentioned in steps below…

Step 1: Export Sales Order Entity customization from CRM Environment

Step 2: Open Customization file and then Update (or Add) IsMailMergeEnabled as 1, Save the changes.

Step 3: Import the changed file in to CRM and publish the changes.

If above method does not work then try following unsupported method, connect database and run following query, change entity name as per your requirement..

Hope this helps..

MayankP 🙂

CRM Data Generator

Just came across requirement where we needed to generate lots of data in CRM system..

Microsoft Dynamics CRM Demonstration Tools (for Microsoft Dynamics CRM 4.0) provides lots of functionality and one of them is Generate Bulk Data for any CRM entity with just few clicks…see below steps for the same..

Step 1: Connect to your CRM Server

This article provides details on how to connect your CRM server on CRM Demo tools.

Step 2: Click on Data Generator tab and select relevant entity and then add relevant data against relevant attribute

Step 3: Select quantity and hit generate data button and this will generate this button.

Other then Data generator this tool also provides functionality to
• Change the Dates and/or Times for Data
• Create Dependent Picklists
• Generate E-Mail
• Set Icons for Entities
• Change the CRM Navigation Pane
• Replace Strings in CRM

Hope this helps…


CRM 4.0 Entity Navigator: small tip

Well What’s best way to navigate through list of entities and it’s attributes in CRM 4.0 quickly ? I have been using following way and I think it’s quickest way to get these information in CRM 4.0

Open IE Browser and type in following URL


Replace servername, portname and organization name of your environment in above link.
This will give you list of entities as below…

Now to get list of attribute either click on entities in above screen print or type following URL (replace entity name as per your requirement)

http:// [servername]:[portname]/[orgname]/sdk/mdbrowser/entity.aspx?entity=account”>

Hope this helps..


CRM 4.0 Loading Live Environment Data to Test/Dev

This is most questions or scenario we encounter I had encounter while working CRM and that is we want to load Live Environment Data to Test/UAT or Development environment.

I decided to give it go and following are detailed step to achieve this in CRM 4.0.

STEP 1: Back up existing Live Database

STEP 2: Restore this database on Dev/Test Database Server. Let’s assume our development database server name SQLDEV and we restored this database with name SQLDEV_MSCRM. It is important to have last string in database name as _MSCRM.

STEP 3: Log in to CRM Deployment Manager

STEP 4: Click on Organizations and then click Import Organization (right hand side)

STEP 5: then select the source SQL Server and source database (as shown in figure below) and click Next

STEP 6: then select the report Server name and generally it would be database server so in out case it would be http://SQLDEV/reportserver and then click Next

STEP 7: Now select the mapping of user as per your requirement, you create mapping file and use that for user mapping. For this example we will keep it simple and just use to auto map users using AD account name and click Next.

STEP 8: System will show you entire list of mapped user and allow you edit user mapping as well. Then we can click next and if any of users does not mapped then system will give warning for the same. Ignore warning and click yes because we can map this manually later on…

STEP 9: System check all system requirements for SQL Server and Reporting Services and then click next
STEP 10: the system will show you Ready to install screen with all summary of new CRM Organisation. Click Import button. System will then create new dev environment with live data.
STEP 11: Done, You will see the success screen and if there is any problem you can check installed log file and the correct problem and start again.
STEP 12: Log on to new environment using URL
http://ServerName:port/Organisation name/loader.aspx

1. You need to be Active directory administrator to be able to do this.
2. This will not do any extra add-ons or custom development which is not part of database so you will need to manually do this on new CRM Environment.

Plug-in type With Id = GUID Does Not Exist

We suddenly started getting following exception on one of our CRM environment.

Unhandled Exception: System.Web.Services.Protocols.SoapException:
Server was unable to process request. Detail:

plugintype With Id = 6ba57788-1975-df11-8b26-0050568d68ea Does Not Exist Platform


The reason this error occurred on our environment is that we had plug in assembly registered on crm database as Database deployment and we then unregister the assembly and registered it again which caused problem because steps of the previous assembly was already there in the database (even though they are marked for deletion).


This is tricky problem and might need unsupported SQL delete of the records which are corrupted.

IMP. NOTE: This is unsupported and you should back up your SQL before doing any changes. If you got MS support then it is better to contact them for this tricky issue.

Basically you need to delete or check records regarding this plug in type and store all the rows you remove in excel file because you might need to refer it again to get the relevant Guid.
Firstly let me explain the list of table which stored plug in related details.

PluginTypeBase – all individual Plug In (classes) will be stored in this table.

PluginTypeBaseIds – This is GUID of the record from PluginTypeBase table (this table links individual class with other tables in CRM).

SdkMessageProcessingStepBase – This table stores all the steps related to particular class

SdkMessageProcessingStepBaseIds – This table stores GUID of the record from SdkMessageProcessingStepBase table.

SdkMessageProcessingStepImageBase – This tale stores image s details related to steps.

SdkMessageProcessingStepSecureConfigBase – This table stores any configuration related to this plug-In type.

Now let’s do select queries first to see all records are relevant to our plug–in type and then we need to just replace delete command with select to remove related records from database.

select * from PluginTypeBaseIds where PluginTypeId = GUID
(e.g. select * from PluginTypeBaseIds where PluginTypeId = 'FB270B8E-B48D-DF11-8D06-18A90547D5EE')

SELECT * FROM PluginTypeBase where PluginTypeId = GUID

SELECT * FROM [SdkMessageProcessingStepBase] where PluginTypeId = GUID

SELECT * FROM [SdkMessageProcessingStepBaseIds] where [SdkMessageProcessingStepId] in (Select
SdkMessageProcessingStepId FROM [SdkMessageProcessingStepBase]
where PluginTypeId = GUID)

SELECT * FROM [SdkMessageProcessingStepImageBase] where [SdkMessageProcessingStepId] in (Select
SdkMessageProcessingStepId FROM [SdkMessageProcessingStepBase]
(Select SdkMessageProcessingStepId FROM [SdkMessageProcessingStepBase]where PluginTypeId = GUID)

SELECT * FROM [SdkMessageProcessingStepSecureConfigBase]

Verify that above queries gives you only record related to your plug-in Type , so read the description column on each row and make sure this is related to your plug in type only, Now we need to start deleting records from bottom tables to top.

-> SdkMessageProcessingStepSecureConfigBase table first (only row related to your plug in type and if your plug in type does not have related record in this table ignore this one) and then

-> SdkMessageProcessingStepImageBase (only record related to your GUID) and then

-> SdkMessageProcessingStepBaseIds (you may need to do this after sdkMessageProcessingStepBase so store Guid
and then delete after you delete records from sdkMessageProcessingStepBase table) (only record related to your

-> SdkMessageProcessingStepBase (only record related to your GUID)

-> PluginTypeBaseIds (only record related to your GUID)

-> PluginTypeBase (only record related to your GUID)

After all delete queries are run successfully restart CRM Service and Asynchronous Service..

Hope this helps, if need more information please put comments on this post and I will respond with more details ..

MayankP 🙂

Getting Contract Details on Contract Line Form

I just came across scenario where we wanted to know contract details on Contract Line form and to my surprise you can not added contract look up on contract line form in CRM. Check it out you will be surprised too 🙂

Well after using IE Developer tool I found that there is hidden field which holds the contract GUID on this contract line form.

So you can use following line to get contract GUID on contract line form.

alert (crmForm.all.contractid.DataValue);

Hope this helps some one as well…