Saturday, October 29, 2011

Create and Send an E-Mail through MS CRM 4.0


using System;
using System.Globalization;
using System.Collections.Generic;
using System.Text;
using System.Web.Services;
using System.Net;
using System.IO;
using System.Configuration;
using TestCrmEmail.Crm.Sdk;
using TestCrmEmail.crmDisc;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Threading;

namespace TestCrmEmail
{
    class CreateEmail
    {
        static void Main(string[] args)
        {
            CreateAndSendCRMEmail("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "Test Subject", "Test Body");
        }

        public static void CreateAndSendCRMEmail(string toGuid, string fromGuid, string emailSubject, string emailBody)
        {

            //Set up CRM service
            CRMHelper objCRMHelper = new CRMHelper();
            CrmService crmservice = objCRMHelper.GetCRMService();

            // Create a FROM activity party for the email.
            activityparty fromParty = new activityparty();
            fromParty.partyid = new Lookup();
            fromParty.partyid.type = EntityName.systemuser.ToString();
            fromParty.partyid.Value = new Guid(fromGuid);

            //Create a TO activity party for email
            activityparty toParty = new activityparty();
            toParty.partyid = new Lookup();
            toParty.partyid.type = EntityName.contact.ToString();
            toParty.partyid.Value = new Guid(toGuid);

            //Create a new email
            email emailInstance = new email();

            //set email parameters
            emailInstance.from = new activityparty[] { fromParty };
            emailInstance.to = new activityparty[] { toParty };
            emailInstance.subject = emailSubject;
            emailInstance.description = emailBody;

            //Create a GUId for the email
            Guid emailId = crmservice.Create(emailInstance);

            //Create a SendEmailRequest
            SendEmailRequest request = new SendEmailRequest();
            request.EmailId = emailId;
            request.IssueSend = true;
            request.TrackingToken = "";

            //Execute request
            crmservice.Execute(request);
        }
    }
}

Some useful question and answers for MS CRM 4.0 interview

 What is CRM?
The Customer Relationship Management is a process or methodology used to learn more about customers' needs and behaviors in order to develop stronger relationships with them.

 What is MS-Dynamics CRM?
Microsoft Dynamics CRM is a multi-lingual Customer Relationship Management software which organize your pre-sale, sale and post-sale process.

How many modules available in MS-CRM?
There are 4 modules. Sale, Marketing, Service and Administration.

What features provide MS-CRM in Sale, Marketing and Service module?
Sales features: Get more leads and close more business

Access a complete view of customer data online or offline, and leverage tools that enable your sales professionals to get real-time access to leads, identify cross-sell and up-sell opportunities, and close more deals, faster. Microsoft Dynamics CRM provides:

·         Lead and opportunity management
·         Account and contact management
·         Territory and sales quota management
·         Forecasting and sales analytics
·         Offline and mobile device access
o    sales literature management
o    sales pipeline and competitor analysis
·         Quick access to products, pricing, and quotes

Marketing features: A clearer view of customers and more informed marketing investments
Segment customer lists into distinct benefit groups and then market to one or more of the identified segments using a workflow-driven model. With Microsoft Dynamics CRM, your marketing professionals can leverage tools for:

·         Customer segmentation
·         Campaign planning and execution
·         Data extraction and cleansing
·         Analytics and reporting
·         Marketing/sales collaboration tools
·         Information sharing portals

Customer service features: Provide more value to customers
Respond faster to customer service issues and empower your service organization to anticipate, address and deliver consistent, efficient customer care that contributes to long-term business profitability. Microsoft Dynamics CRM provides functionality for:

·         Account and contact management
·         Case and interaction management
·         Incident routing and queuing
·         Product and contract management
·         Knowledge-base management
·         service scheduling
·         workflow across teams and groups
·         service reporting and analytics

What is CRM Service of MSCRM?  
CRM Service is the main web service and it exposes Six methods such that you can write your code against CRM entities. To perform operation other than the six operations (six methods provided by mscrm) we will have to use the Execute method.

What is Metadata service of MSCRM?  
Dictionary meaning of the word METADATA is data about data and similarly the metadata holds the information about MSCRM means the information about the entity and attribute e.g. Display name, platform name, size of the attribute, datatype of attribute etc. If we want to access any information about any entity (Dynamic or system) we will have to make use of the Metadata service. In the database we can find the metadata table and name of these table begins with keyword Metadata.

What is CRM Discovery Service?  
The Discovery service is a global service that helps the caller to determine the correct organization and URL. Microsoft CRM server may include several servers. Each server might be dedicated to multiple organization. Each of these servers will have dedicated web-service URL for faster operations. Internally the Microsoft CRM server allocation may change so the discovery service directs the request to its corresponding web-server for further processing.
In short the Discovery service responsibility is to find the ‘CRM Service’ and ‘Metadata Service’ urls.
The discovery service returns the list of organization URLs that the current-requester (current user) belongs to. During the Outlook client configuration discovery service shows he list of organization the current-user belongs to.
This web-service is used to create authentication ticket in case of Windows live authentication.

The web service has three different end point based on authentication mode

Active Directory –
http://servername:port/mscrmservices/2007/AD/CrmDiscoveryService.asmx

IFD –
http://servername:port/mscrmservices/2007/IFD/CrmDiscoveryService.asmx

Online –
https://dev.crm.dynamics.com/mscrmservices/2007/passport/CrmDiscoveryService.asmx

In case of IFD and Online, we neet to obtain CrmTicket information that is required.
In case of Online we also need policy information and Passport ticket.
These information provided by CrmDiscoveryService is used for configuring CrmAuthenticationToken and CrmService instances.

What is a Plug-in?  
A plug-in is custom business logic that you can integrate with Microsoft Dynamics CRM 4.0 to modify or augment the standard behavior of the platform.

What is a Workflow?  
Workflow enables automation of business processes during which documents, information, or tasks are passed from one party to another and actions are performed according to a set of rules.

What are the differences between Plug-in and a Workflow? 
1.        Workflow solution requires zero code maintenance and a normal user or administrator can create the Workflow.
Whereas for Plug-in , needs a Professional to develop it or the individual who as some programming knowledge.

2.         Workflow includes a limited set of Events. For Example Create, Update & Delete.
Plug-in includes a number of Events like Create, Update, Delete, Retrieve, Retrieve Multiple, Send, Set-state, Assign, Route & Merge.

3.        Workflow can only work as Asynchronous.
Whereas Plug-in can work both way Synchronous & Asynchronous.

4.        Workflow can work on only Asynchronous Operations mean after the event occur. For example, On creation of Lead an E-mail needs to be generated to the Owner of that Lead. In this example the E-mail will be send to the Owner of that Lead when the Lead get created.
Where's Plug-in can be implemented as Pre-Event and Post-Event.
5.        Plug-in features include  Pre-Image & Post-Image.
Whereas Workflow include only Post-Image.

6.         Workflow can run Automatically & Manually.
Whereas Plug-ins cannot be run manually; they only run on the steps for which they are registered.

NOTE:-
The biggest difference between the two techniques is in the timing of the actual update. Plug-ins can be executed either Synchronously or Asynchronously. Workflows function in an asynchronous manner.

The Synchronous operation will modify the data stream as it is being saved to the database, which can introduce a delay in the user's experience, but will provide results back to the user in a quicker fashion.

Asynchronous operations will happen shortly after the data has been saved which will not impact the user, but which may result in a slight delay between the time the user saved the record and when the value will be updated.

What are the differences between Asynchronous Plug-in and a Workflow?  
You can have images in your plug-in but not in workflow.
Plug-in-Images:
Plug-ins in Dynamics CRM, allow you to register images against the steps of a plug-in assembly. Images are a way to pass the image of the record that is currently being worked upon prior or after the action has been performed. In general it could be said, it is the image of the record as is available in the SQL backend.
Two types of Images are supported, Pre-Image and Post Image.
In case of Pre-image, you get the image of the record as is stored in the SQL database before the CRM Platform action has been performed.
Post Image, returns the image of the record after the CRM Platform action has been performed.

What is an Email-Router?  
The E-mail Router is an interface between the Microsoft Dynamics CRM system and one or more Exchange servers or POP3 servers for incoming e-mail, and one or more SMTP servers for outgoing e-mail. E-mail messages come into the Microsoft Dynamics CRM system through the E-mail Router.

The three main components that can be installed during E-mail Router Setup are as follows:
•Microsoft Dynamics CRM E-mail Router Service
•Microsoft Dynamics CRM E-mail Configuration Manager
•Microsoft Dynamics CRM E-mail Rule Deployment Wizard

What are the steps to configure an Email router?  
Configure the E-mail Router by using the E-mail Router Configuration Manager

How the Plug-in and Workflow will behave in case of Off-line client?  
The workflows does not work in case of off-line client (because workflows required MSCRMAsyncService and which is only available on server) but plug-ins can, if plug-in is deployed to execute on off-client then it will be executed as per registered step on SDK Message. If only deployed for Server then during outlook off-line client data synchronization the plug-in will be executed on Server side.

What is Metadata?  
The Microsoft Dynamics CRM metadata contains the description of system and custom entities, attributes and the relationship between entities for an organization. The MetadataService Web service provides the messages that you can use to read or write the metadata. In Microsoft Dynamics CRM 3.0 you used the MetadataService Web service to read the metadata. In Microsoft Dynamics CRM 4.0 you have ability not only to read, but also to change the metadata.

What is 1:1, 1:N and N:N relationship in Microsoft Dynamics CRM?  
A 1:N (one-to-many) Relationship is a hierarchical relationship created or viewed from the primary entity. Any one entity instance from the primary entity can be referenced by many entity instances from the related entity.

An N:1 (many-to-one) Relationship is a hierarchical relationship created or viewed from the related entity. Many entity instances from the related entity can reference any one entity instance from the primary entity.

Remember that the same relationship can be viewed from either of the two entities that participate in the relationship.

Both relationships are represented by the OneToManyMetadata class. Notice that the Microsoft Dynamics CRM Web application uses the terms primary entity and related entity while the metadata service uses the terms referenced entity and referencing entity.

N:N (many-to-many) Relationships
A many-to-many relationship lets users relate one or more entity instances from another entity to an entity instance of the current entity. A many-to-many relationship is reciprocal. Therefore, entity instances can be related from either entity. A many-to-many relationship may also be self-referential. This means that one or more other entity instances of the current entity can be related to an entity instance of the same entity.

This kind of relationship is represented by the ManyToManyMetadata class.

When you create a many-to-many relationship, an intersect table is created. You can use the intersect tables in the QueryExpression for a RetrieveMultiple query, but you cannot retrieve the intersect table records directly with the RetrieveMultiple method. To retrieve the records in an intersect table, you must use the Fetch method. For more information, see Using Intersect Tables.

Self-Referential Relationships
In a self-referential relationship, an entity has a relationship with itself. Both hierarchical relationships and many-to-many relationships can be self-referential. This allows entity instances to be directly associated with other entity instances of the same type. For example, opportunities can be linked to related opportunities.

The only limitation to self-referential relationships is that entity instances cannot be related to themselves in a parental relationship. This creates a circular reference.

How a Plug-in is different from a Call-out?  
Call-Out were used in Dynamics CRM 3.0 version and in earlier version from 4.0 onwards Call-out has been replaced by Plug-ins (which has more functionality, SDK Messages supports and Newer .Net versions support) plug-in can also be dpeloyed into the database but call outs can be only deployed into the disk directory <CRM Installation Dir>\Server\Bin\Assembly

Callout
A callout is custom business logic that you can add to modify or augment the standard behavior of the Microsoft CRM system. Another way to think about callouts is that they are extension points made available by the Microsoft CRM system. You can subscribe to a published set of events to have your code run when the event occurs. As part of the subscription, you must specify an event handler. The event handler is a segment of code that runs in response to the system event that is fired. Your event handler must comply with the callout interface. The callout model supports both pre-callouts and post-callouts. Pre-callout code is run before an operation occurs; post-callout code is run after an operation has been completed. There can be any number of pre-callouts or post-callouts associated with a given entity and event. Only supports .NET Framework version 1.1.

Plug-ins
From CRM 4.0 Call-Out has been replaced by Plug-ins, supports .Net Framework latest versions 4.0 and have more rich functionality and support execution on far more SDK messages then call-outs and can be executed Synchronous and Asynchrnous and Plug-in Pre-Operation and Post-Oprtation stage execution involves a database transaction so if the InvalidPlug-inExecution exception will be thrown then the database Create, Update etc operations will be automatically rolled back.

You can also refer MSDN information:

Comparing Plug-ins to Callouts
The programming model for adding business logic extensions to Microsoft Dynamics CRM has changed in the latest Microsoft Dynamics CRM 4.0 SDK release as compared to the 3.0 release. This change was the direct result of customers asking for access to more capabilities and run-time information in plug-in code. In addition, architectural changes and feature additions to Microsoft Dynamics CRM 4.0 necessitated changes to the programming model so that plug-ins could take advantage of the new platform capabilities.

What about your existing callouts? Do you have to throw them away and develop new plug-ins? The good news is that Microsoft Dynamics CRM 4.0 is backwards compatible with the callout programming model. Your existing callouts should continue to work alongside any new plug-ins that you develop as long as you do not use any deprecated features. However, if you want to take advantage of the new Microsoft Dynamics CRM 4.0 capabilities and the rich information that is available at run time, you need to make use of the plug-in programming model.

The following points highlight what has changed when comparing the new plug-in programming model to the previous callout model.

Registration
Callouts are registered by editing an XML configuration file that is stored in a specific folder on the Microsoft Dynamics CRM 3.0 server. In essence this is a static registration method. Changes to the configuration file require an IIS reset to apply the changes.

Plug-ins are registered dynamically through a new registration API. No IIS reset is required. Sample tools to register plug-ins, complete with source code, are provided in the SDK.


Context
Callouts received a basic amount of data at run-time about the user who initiated an operation in Microsoft Dynamics CRM and the entity being acted upon.

Plug-ins receive a wealth of information at run-time. For more information, see the following What’s New topic.


Supported messages
Callouts could only be executed in response to a subset of messages that were processed by the Microsoft Dynamics CRM platform.

Plug-ins can execute in response to most messages being processed by the platform.


Mode of execution
Callouts were executed synchronously as part of the main execution thread of the platform. Callouts that performed a lot of processing could reduce overall system performance.

Plug-ins can execute both synchronously and asynchronously. Asynchronous registered plug-ins are queued to execute at a later time and can incorporate process-intensive operations.

What is ‘Append’ and ‘Append To’ privilege in MSCRM? Give one example of it?  
‘Append’ and ‘Append To’ privileges works together. ‘Append To’ privilege will allow other entities to get attached with the entity. ‘Append’ privilege will allow the entity to attach the records to the entity with ‘Append To’ privilege.

Let us understand this with simple example:
Let us say that you want to attach a note to a case then note entity should have ‘Append’ access right and case entity should have ‘Append To’ access right.

Let us take one more example to understand this. Suppose you have two custom entities called ‘TestCustomEntity1 and ‘TestCustomEntity2. You want to attach the ‘TestCustomeEntity2 records to ‘TestCustomEntity1records. For this you need to have ‘Append’ access right on ‘TestCustomEntity1 entity and ‘Append To’ access right on ‘TestCustomEntity2.
Now guess will I be able to attach the records? Answer is “NO” because we need to create a 1:N relationship between ‘TestCustomEntity1 and ‘TestCustomEntity2.
Now the user who has above mentioned access right in his security role will only be able to add ‘TestCustomEntity2 records to ‘TestCustomEntity1.

How to create a Custom Entity record using SDK?  
Using Dynamic Entity

How to join two table using Query Expression?  
Using Linked entity. You should always try to minimize the number of SWS calls that we make in the database. Often during code review it is explored that the number of Microsoft CRM web-service could have been reduced by making use of the Linked-entity concept. So we should always look for the opportunity to minimize the effort.

Can we modify the name of Root Business Unit?  
No; We will have to re-install MSCRM

Suppose if I have 100 user license and I have created 100 users. What will happen if I create 101User?  
The 21st User will get created in MSCRM but that user will be in disabled state

What are the maximum number of tabs allowed on a Microsoft Dynamics CRM 4.0 form?  
8

How to enable/disable the form assistant? How to make sure the form assistant is expanded / collapsed-on a form?  
Navigate to Customization >> Open the Entity >> Open Forms and Views >> Open Form >> Select Form Properties >> Open Display Tab >> Check/Uncheck the “Enable the Form Assistant” and “Expanded by Default”.
What is Filtered Views?  
SQL database views, called "filtered views," are provided with the Microsoft CRM database to enable access to business data according to the user's Microsoft CRM security role. When a user runs a report that obtains data from filtered views, the user's Microsoft CRM security role determines the data to be included in the report. Data in filtered views is restricted at three levels: the organization, the business unit, and the owner. Filtered views exist for all Microsoft CRM business objects (entities).
The reports should not read data directly from the Microsoft CRM database tables. Instead, use the filtered views.

Can we change a base currency?  
Yes, Only if you re-deploy your organization using the Deployment Manager.

Can we remove the root Business Unit?  
No, We can deactivate business unit.

Can we use the same database for different instance?  
No, we can’t. Because every instance (or organization) have their own database like Organization_MSCRM database.

Can we add new button in Actions menu?  
In CRM, it’s widely known that you can add buttons to both system and custom forms. However, there aren’t too many examples on how to do it, and also some practical examples. To add a button to a CRM form, you simply need to edit the ISV.config file.

Here’s an example on how to add a button on the Account form that when clicked, will open a new internet explorer page to www.microsoft.com.

·         1. Go to Settings | Customization | Export Customizations
·         2. Export the ISV.Config file
·         3. Open the file using any xml/text editor (NOTE: Some text editors may cause the xml to get corrupted so be careful. Ideally an XML editor is recommended). Add an entry for a new button to the Account toolbar.
·         <Button ToolTip = “Open Window” Icon =”/<insert relative path>” Title = “Open Window” JavaScript=”window.open(‘http://www.microsoft.com’)”;/><ToolBarSpacer/>
·         4. In the above example you can see I navigated to the Account entity’s toolbar and created the entry with the following parameters:
ValidForCreate: 0 = button will not show up on a “Create” form. 1 = button will show up on a “Create” form.
ValidForUpdate: 0 = button will not show up on an “Update” form. 1 = button will show up on an “Update” form.
Button ToolTip: when a user performs a mouse over action on the button, a dialog box will appear with whatever text specified here.
Icon: relative path of the icon used for the button.
Title: name to appear on the button.
·         5. Determine whether to attach a JavaScript code snippet or function to the click on the button. (NOTE: You can also reference a JavaScript method here that exists in another file, however, that file must be referenced at the onLoad() or onSave() methods of that form)
·         6. A new button should now appear on the toolbar and after clicking it, a new internet explorer page opens to www.microsoft.com

Can we hide Add Existing from Entity?  
Yes, we can.

Relationships in MS Dynamics CRM 4.0 (parental, referential, Non Referential)?  
When you create a hierarchical relationship you can control how the relationship behaves to support both data integrity and business rules for your organization. The relationship can control how actions that are performed on a parent record will cascade down to child records.

The relationship type defines the cascading rules for a relationship. The following table describes the possible relationship types.

Relationship type Description
System A parental relationship type automatically defined by Microsoft Dynamics CRM for system entity relationships. You cannot modify this kind of relationship.
Parental All operations on the parent entity instance are propagated to the child entity instances (cascade all):
•If the entity instance is deleted, its related entity instances will also be deleted.
•If the entity instance is assigned to another user, its related entity instances will also be assigned to the other user.
•If the entity instance is shared with another user, its related entity instances will also be shared with the other user.

Referential Operations are not cascaded between entities (cascade none):
•If the entity instance is deleted, only the link from its related entity instances is deleted.
•If the entity instance is assigned to another user, its related entity instances are not affected.
•If the entity instance is shared with another user, its related entity instances are not affected.

Referential, Restricted The entity instance can only be deleted if it has no related entity instances. Otherwise, this relationship type is the same as referential.
Configurable Cascading Cascading rules can be configured for most actions. For system relationships, you can select the cascading rules for all actions except merge or delete. For custom relationships, cascading rules can be selected for all actions except merge. Cascading on merge is dependent on the referenced entity. If the referenced entity is an account, contact, or lead, the action cascades. Otherwise, it does not.

Each entity can only participate as a related (referencing) entity in one parental or configurable cascading relationship. Most Microsoft Dynamics CRM system entities already participate in a parental relationship and this relationship cannot be changed. An entity can participate in multiple parental relationships as a primary (referenced) entity. There is no limit to the number of referential relationships that an entity may participate in.

Relationship Behavior in MS DynamICS CRM 4.0 (Cascading, Cascading to record, Cascading None, SetConfigure)?  
In Microsoft Dynamics CRM you can control how certain actions on a parent record affect child records. The actions that have cascading behavior are as follows:

•Assign
•Delete
•Merge
•Reparent
•Share
•Unshare

The cascading rules are described in the following table.

Rule Description
Cascade All Perform the action on the specified entity instance and all related entity instances. 
Cascade None Perform the action on the specified entity instance only. Do not cascade to related entity instances.
Cascade Active Perform the action on the specified entity instance and all related entity instances that are active or open.
Cascade User Owned Perform the action on the specified entity instance and all related entity instances that are owned by the same user as this entity.
Remove Link Perform the action on the specified entity instance and remove the link to the related entity instance. No changes are made to the related entity instance.
Restrict Applies to delete only. The delete is not allowed if there are other entity instances that reference the ID of the entity instance being deleted.

How to achieve 1:1 Relationship in MS Dynamics CRM 4.0?  
Yes it is not  possible in  MS CRM 4. But you can do something like this.

Method 1:
Create a 1:N relationship between Entity A & Entity B

1) On Entity A, You  will have a left navigation pane where you can add more than one Entity B (instances), Now you have to hide it, it is pretty straight fwd.

document.getElementById("navEntitiesB").style.display = "none"

2) On Entity B,  Add  the lookup field, This lookup Field means only 1 record from A can be associated with B.

that’s' it,  now you have restricted B to be added against only one A and on  A you have hidden  the possibility of adding entities instances.

Method 2:
Onn form load, use the web service to retrieve an instance of Entity B that is related to Entity A. If it returns null then carry on, if it returns an instance then close the window before anything else happens:

window.close();
return false; // to stop the form showing a message to say that things haven't been saved

Obviously you might want to put in a descriptive alert box too so the end user knows why it's not allowing them to create a new instance.

How to get parameter for Custom WF from UI of the workflow?  
CrmInput to access the parameter within the CRM workflow form. Example: [CrmInput("ParameterName")]

How to debug the WF?  
To Debug the custom workflow activity you have to copy the pdb file of you assembly to %installdir%\server\bin\assembly on your CRM server, set a breakpoint in your Execute method and attach your Visual Studio project to Microsoft Dynamics CRM asynchronous service (process CrmAsyncService.exe) on your CRM Server.

What is the difference in Using CRM Web Service and SDK DLL?  
My opinion is that the best-kept secret in the CRM SDK is that you can use the SDK assemblies directly and completely avoid the problems of adding a web reference to your CRM directly into your development project.
First off, I will give a little background for some of the new CRM developers out there.  Most CRM programming examples start out by having you create a web reference to your CRM services (there are three services in total).  When you add a web reference, you have to give the web reference a name and a namespace.  What happens under the hood is that this information is used to build proxy client classes that can be used to consume the services in your client application. As a result, many of the code examples you see don't compile on their own until you add a web reference, and when you do that, you need to add it with the exact name and namespace that was used in the code for this to work properly. 
Another consequence of adding a web reference is that you now have a url to your CRM embedded directly into your code.  Nobody in their right mind will be developing against their production CRM, so in essence, you will really have a url to your development CRM instance in your code.  You have two choices at this time - you can change the code before you deploy (bad idea), or you can add an application variable to your configuration file and then substitute the url in code at runtime.  This means additional code, and each code example you find has a differnent name for the application variables, and there are more than one of them because you frequently also have to provide credentials as well.  Finally, none of this works for CRM Online, nor for SPLA deployments.  You will find that most CRM examples out there will only work for on-prem deployments, which is really not that ideal.
Another issue with using a web reference is that the web reference to your CRM is a dynamic web reference.  Microsoft has decided to model out your CRM entities and customizations in the web reference to give you some classes to work with.  For example, you will see a contact class with all the attributes in your contact entity.  At first, this looks pretty convenient, but consider that the service wsdl changes every time a business user customizes the CRM and hits the publish button.  What you are left with is a dynamic contract.  Contracts are supposed to be fixed in my opinion.  It is too fragile to have a dynamic service reference that can cause runtime errors in your existing applications just because someone customized the CRM by cleaning up an unused field or adding another one.
Microsoft has a better way for you to use the CRM.  They have included assemblies (microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll) in the CRM SDK.  These DLLs have everything you need to fully utilize the CRM.  When you use these DLLs, there is no reason you have to add a web reference to your project.  They are so easy to use that I am surprised that not all examples are written to use them.  It certainly would make for a better getting-started scenario as all examples could compile and run without any code changes.
The most significant difference you will find is that you will have to use the dynamic entity when you work with your CRM entities.  I view that as a good thing (check out my other blog article).
When you are developing plugins, you are forced to use the assemblies in the SDK, so eventually you will find that you have to know how to use them anyways, so in my opinion, it is better to use them everywhere and get rid of all the problems of using a web reference.
When you start to work more with the CRM SDK, you will eventually use some form of connection or configuration library, and any reusable library will need to use the SDK dlls as well instead of your web references, especially if they are compiled into a seperate dll.

Different way of registering plug-in
We can register plugin in database, File(Disk) and GAC  

Difference between entity and Dynamic Entity?  
In Microsoft Dynamics CRM, you can use the Entity class to work with entities instead of the DynamicEntity class used in Microsoft Dynamics CRM 4.0. This lets you use late binding so that you can work with types such as custom entities and custom attributes that were not available when your application was compiled. When initialized, the Entity class contains the logical name of an entity and a property-bag array of the entity’s attributes. Because the entity base class always contains the property bag of attributes and values, the ReturnDynamicsEntities property from Microsoft Dynamics CRM 4.0 is no longer necessary.

The key difference between early and late binding involves type conversion. While early binding provides compile-time checking of all types so that no implicit casts occur, late binding checks types only when the object is created or an action is performed on the type. The Entity class requires types to be explicitly specified to prevent implicit casts.

Field Level Security. People will say using JS and all and then u can ask @ what will happen to views?  
A common design misconception about providing field-level security in CRM forms is that client-side JavaScript can be used to secure the access. In fact, client-side JavaScript does not provide true field-level security access because although a field may appear inaccessible to a user, the field data is still transmitted from the server to the client and a number of techniques could be used to retrieve the information at the client or at the network level.

For Field Level security first Identify Access Points of CRM Platform. As per my opinion there are following access channels and methods:


Access Channel
Access Methods
CRM Application
CRM Web Client
CRM Outlook Client (online and offline)
CRM E-Mail Router
Mobile Express
CRM SDK Web Services
Plug-ins, workflow assemblies
External applications
Custom pages
Filtered Views (CRM Database)
External applications
CRM Export-to-Excel feature


The CRM Application and CRM SDK Web Services Access Channel works through CRM Platform, So with the help of Security Roles and Create, Retrieve, Retrieve Multiple and Update Plug-ins we can maintain security for CRM Platform.

We can implement Filtered Views (CRM Database) security from denying user membership to the CRM Reporting Group.

Web service call through JavaScript. JS Debugging?  
In Microsoft CRM 4.0, you can use the WebService to perform many actions that you just can’t do via JavaScript. The WebService can be used for any of the following methods:
·         Create
·         Update
·         Delete
·         Fetch
·         Retrieve
·         RetrieveMultiple
·         Execute
DB Structure for MS Dynamics CRM 4.0. What information MSCRM_Config DB will have?  
When we create a new organization in MSCRM server then it creates a separate database for particular organization like organizationname_MSCRM. On CRM server we can create multiple organizations and the metadata for all organizations store in MSCRM_Config Database.

How do you move an organization from one server to other server. What all are the steps u will follow?  
Step1.  Open Deployment Manager from Source Server.
Step2.  Select Organization and Disable it.
Step3.  Delete Disabled Organization.
Step4.  Take Backup of Deleted Organization database “organization_mscrm” on disk and move that on Target Server.
Step5.  Restore Backup database on Target server.
Step6.  Open Deployment Manager on Target Server.
Step7.  Run “Import Organization” wizard and follow all steps.
How do you build the custom report. How u will you upload in MS Dynamics CRM 4.0?  
Step 1: Open Business Intelligence Development Studio (BIDS 2005) we can develop a custom report with “Report Server Project Wizard”.
Step 2: Open CRM web Client, select workplace, select Reports
Step 3: In Reports, select New Report and choose Report Type “Existing File”.
Step 4: Browse your BIDS report (.rdl) file path and finish the report server wizard.

Team Concept in MS Dynamics CRM 4.0. Where do you use it?  
Teams are arbitrary groups of users created and defined by a user in an organization. A Team contains their own Roles. As an example, If we are a service provider of 4 wheeler vehicles then we can create separate teams like “Maruti Service Team”, “Mercedes Service Team” etc, and add users in team those are having specialization in particular car parts.

Site Map and ISV Config difference and use in MS Dynamics CRM 4.0?  
You can customize the contents of the Navigation Pane in Microsoft Dynamics CRM by editing the Site Map. The Site Map is an XML document, and if you've never edited an XML document before, using tools that provide schema validation can make this much easier.

Some of the customizations you can perform include:

Change the name of areas in the Navigation Pane
Change the order of areas in the Navigation Pane
Reorganize or add new areas
Change the order of the links presented within areas
Change the names of links in an area
Group links in areas
Change the Workplace profile options that people can choose from

If you want to add custom menuitems, modify navbars, add funtionality to toolbars etc. you need to modify so called ISV.config.

How many tabs you can have on form and how to increase the count of it?  
By default the max number of tabs allowed in CRM Form is 8.
The max tab limit is defined in JavaScript of formeditor.aspx. This page can be found at the following location “\Microsoft Dynamics CRM\CRMWeb\Tools\FormEditor”.
You can change the count specified in the _iMaxTabs to increase the count.
Note: This is an unsupported change and it could be overwritten if you install Rollups for CRM.

What is the Difference between Secure / Unsecure Configuration of Plugin Registration tool in MS CRM 4.0 ?
Secure Configuration:
The Secure Configuration information could be read only by CRM Administrators.(Eg: Restricted data from normal user could be supplied here)

Unsecure Configuration:
Unsecure configuration information could be read by any user in CRM. Remember its public information (Eg: Parameter strings to be used in plugin could be supplied here)