Wednesday, October 24, 2007

Create CustomerOpportunityRole Record

This is a very simple code, when you wants to create a CustomerOpportunityRole.


// Create the class
customeropportunityrole oppRole = new customeropportunityrole();

// Define the "Customer" to relate the Opportunity to. // This could be an Account or a Contact//
oppRole.customerid = new Customer();
oppRole.customerid.Value = new Guid("605291D0-C91E-DC11-944B-0003FF0E1518");
oppRole.customerid.type = EntityName.account.ToString();

// Define what Opportunity this relationship is for
oppRole.opportunityid = new Lookup();
oppRole.opportunityid.Value = new Guid("701C12F1-896A-DC11-961B-0003FF0E1518");
oppRole.opportunityid.type = EntityName.opportunity.ToString();

// Define what Relationship Role to use
oppRole.opportunityroleid = new Lookup
oppRole.opportunityroleid.Value = new Guid("D2A640E1-B81A-DC11-A7F0-000C29C33583");"Referral";
oppRole.opportunityroleid.type = EntityName.relationshiprole.ToString();

// Assign StatusCode, StateCode
CrmNumber codeNumber = new CrmNumber();
codeNumber.Value= 1;
oppRole.opportunitystatuscode = codeNumber;

codeNumber.Value= 0;
oppRole.opportunitystatecode = codeNumber;

// Create the relationship
Guid id = service.Create(oppRole);
catch(System.Web.Services.Protocols.SoapException ex)
MessageBox.Show(ex.Detail.InnerText.ToString() + ex.Message.ToString());

Tuesday, October 16, 2007

Enable tracing in Microsoft Dynamics CRM 3.0

Microsoft Dynamics CRM 3.0 lets you create trace files that monitor the actions that are performed by Microsoft CRM. Trace files are helpful when you have to troubleshoot error messages or other issues in Microsoft CRM.You can create unmanaged trace files and managed trace files. The information in the unmanaged trace files and in the managed trace files is determined by required and optional registry entries that you create manually. You create these registry entries on the Microsoft CRM server or on the computer that is running the Microsoft CRM client for Microsoft Office Outlook after you install Microsoft CRM or the Microsoft CRM client for Outlook.

This article published on Microsoft, for more information

Happy MS CRM Tracing !!!!!!

Thursday, October 11, 2007

Remove / Detach Email from Queue

DetachFromQueueEmail Message
Detaches the e-mail from the specified queue.

// Use below code.

// Rreplace the WebService URL
service.Url = strWebServiceURL;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

DetachFromQueueEmailRequest objEmail = new DetachFromQueueEmailRequest();

// Assign Email GUID
objEmail.EmailId = new Guid(strEmailGUID.Trim());

// Assign Queue GUID
objEmail.QueueId = new Guid(QueueIdNode.InnerText.Trim().ToString());


Is it so simple..........right.

Saturday, September 29, 2007

Reference javascript file in Form_onLoad Event of an Entity.

Reference javascript file in Form_onLoad Event of an Account Entity.

Create a sub virtual directory under MS CRM Virtual root directory and place your .JS files in sub virtual directory.

Name of the sub virtual directory under MS CRM Virtual root directory is: "Customizations".
and Name of the JavaScript file you have created is "Account_Entity_Customizations.js"

Go to
Settings => Customizations => Custom Entitites => Select Account Entity => Open (double click) => Forms and Views => Form =>Form Properties => Edit OnLoad Event.

Copy paste below code in the OnLoad Event Box (select enable javascript event check box):

var oScript_Account = document.createElement("<script src='/Customizations/Account_Entity_Customizations.js' language='JavaScript'>");
document.getElementsByTagName("head")[0].insertAdjacentElement("beforeEnd", oScript_Account); 

Save and Publish the Entity.

Refresh MS CRM Portal.

Open Account Entity, you will see your JavaScript code working.

Happy Coding !!!!!!!!!!!!!!.

Friday, August 31, 2007

Create a report in 15 minutes or less

Help your team make effective business decisions based on data from Microsoft Dynamics CRM 3.0. With an understanding of the business reasons for the report and how a database works, you can create a Microsoft SQL Server Reporting Services report. After you follow the steps in this tutorial and install the required tools, it only takes a few minutes to write a useful report and to add it to Microsoft CRM. You need no prior knowledge of the required tools.

This article published on Microsoft on Updated: May 31, 2007

For more information visit:

Tuesday, August 7, 2007

E-mail activities are not automatically sent to the recipients when you distribute e-mail activities for a campaign in Microsoft Dynamics CRM


When you distribute e-mail activities for a campaign in Microsoft Dynamics CRM, the e-mail activities are not automatically sent to the recipients. Instead, you have to open each e-mail activity. Then, you have to send each e-mail activity manually.

This article published on Microsoft on 06 June 2007.

For more information visit:

11 things to know about customization

This series of articles describes some basic customization features and concepts। These articles highlight key information about the capabilities and limitations of these feature areas.

This article published on Microsoft on 20 April 2007.

For more information visit:

Thursday, July 26, 2007

Enabling the Default Internet Explorer Context Menu

In addition to running in Application Mode, Microsoft CRM modifies the standard Internet Explorer behavior by displaying its own context menu when you right-click in the application. Right-clicking a grid gives you options unique to Microsoft CRM, such as Open, Print, and Refresh List. However, right-clicking a form won't display a context menu like you would see on a normal Web page. When you're troubleshooting and debugging, you might find that you want to access the standard Internet Explorer context menu so that you can use features such as View Source, Properties, or Open In New Window. You can re-enable the Internet Explorer context menu by editing the Global.js file.
Re-Enabling the Internet Explorer Standard Context Menu
  1. On the Microsoft CRM Web server, navigate to \_common\scripts (typically C:\Inetpub\wwwroot\_common\scripts).

  2. Open the Global.js file in Notepad (or any text editor). Note: Do not double-click this file because it will attempt to execute the JavaScript file.

  3. Right-click the file, and then click Edit.

  4. Use your text editor's Find feature to locate the document.oncontextmenu() function.

  5. Comment out the existing code in this function by adding /* and */ as shown in the following code. You can undo this change later by simply removing event.returnValue = true; line and the comment characters.

    function document.oncontextmenu()
    event.returnValue = true;

    var s = event.srcElement.tagName;
    (!event.srcElement.disabled &&
    (document.selection.createRange().text.length > 0
    s == "TEXTAREA"
    s == "INPUT" && event.srcElement.type == "text"));

  6. Save the file.

  7. Open a page in Microsoft CRM and right-click it. You will see the familiar Internet Explorer context menu.


Use this technique on development servers only. Do not modify the Global.js file in a production or staging environment; this unsupported change might cause unpredictable behavior. Microsoft CRM prevents use of the right-click context menu for the user's benefit and also to maintain a predictable navigation structure in the application interface.

Application Mode and Loader.Aspx

Of course you've noticed that Microsoft CRM launches into a special Internet Explorer window that does not have the menu bar, address bar, toolbar, and so on. Microsoft CRM refers to this as the Application Mode, and it runs in this mode by default. Often, developers need these additional Internet Explorer features that application mode hides. You can launch Microsoft CRM in a standard Internet Explorer window by browsing to http://<crmserver>/loader.aspx.

Using the Loader.aspx page disables application mode for that single Web session. You can also permanently disable application mode for all users and all sessions by updating the Web.config file.

Disabling Application Mode
  1. On the Microsoft CRM Web server, navigate to \ (typically C:\Inetpub\wwwroot\).

  2. Open the Web.config file in Notepad (or any text editor).

  3. Look for the AppMode key, and change its value to Off.

  4. Save the Web.config file.

Wednesday, July 25, 2007

"Titan" Microsoft CRM 4.0

Currently the "Titan" Microsoft CRM 4.0 is in CTP.

New version of Microsoft Dynamics CRM delivers the power of choice to customers with on-premise, partner-hosted and Microsoft-hosted deployment models.

It also uses a single code base to support on-premise deployments as well as software-as-a-service (SaaS) deployments through hosting partners and the upcoming Microsoft Dynamics Live CRM service. The “Titan” release is an evolution of the popular Microsoft Dynamics CRM 3.0 product, and will offer a smooth upgrade path for existing on-premise and SaaS customers. It reinforces Microsoft’s long-term strategy to provide customers with the power of choice, with the ability to choose on-premise or SaaS deployments and access rich CRM capabilities within Microsoft® Office Outlook®, through a Web browser, and from a broad range of mobile devices.

Key improvements to Titan are:

  1. Multi-tenancy (handling multiple Microsoft CRM deployments on a single server - the ability to host multiple companies CRM data on a single server)
  2. Multi-language (supporting multiple languages in a single deployment)
  3. Even tighter integration with Microsoft Office 2007

Read more at:

Callout vs. Workflow

You might find yourself wondering when you should use a pre- or post-callout versus when you should use a workflow rule. As you would expect, the answer depends on your situation. For instance, if you need to take an action before the data reaches the platform, you will have to use a callout (pre-callout in this case). If you would like the user to manually instantiate the action, a manual workflow rule would be used.

Remember that any action or event available in workflow can be done with the callout and the SDK. However, the reverse is not true. In general, keep your callout routines as simple and fast as possible. When processes become long, see whether you can transfer them to a workflow assembly for asynchronous processing.

We would recommend the following guidelines to help you decide when to use a callout versus a workflow assembly:

Use callouts

  • To alter data prior to submission to the platform.

  • To take action after an update to an entity. (Workflow does not provide an easy trigger mechanism for the update event.)

  • When you need a synchronous transaction and an immediate response.

  • To take action before or after the merging of two records or the deletion of a record.

  • When accessing custom entities that are organization-owned. Workflow can be used only on entities that have user ownership.

Use workflow

  • For all asynchronous actions—transactions that can be completed without having the user wait for their completion. A typical asynchronous action might be to send an e-mail message after some condition is met. The user usually wouldn't have to wait until the system created and sent the message.

  • For simple common tasks. The Workflow Manager has a list of actions, already built and available for use, that require no custom application development. Available actions include creating new records (such as Activities or Notes), sending e-mail messages, and updating values on related entities.

  • To allow more configuration options to the user who is creating the workflow logic. Because the user builds the workflow rule with the rule editor, he or she can also alter it without necessarily requiring programmatic interaction.

  • When you need a user to manually execute the necessary logic.