Friday, 23 August 2013

Delete Event in Mscrm 2011

  
context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (context.InputParameters.Contains("Target") &&
 context.InputParameters["Target"] is EntityReference)
{
if (context.MessageName == "Delete")
{
 // Code to be executed during Delete event
}
}

Whereas Create / Update events work as follows

context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));


if (context.InputParameters.Contains("Target") &&
 context.InputParameters["Target"] is Entity)
{
  
 if (context.MessageName == "Create")
 {
//Code to be executed during Create event of an entity
}

   if (context.MessageName == "Update”)
{
//Code to be executed during Update event of an entity
}

}

Issue in Duplication detection Rule

I imported and published the new set of customizations I'd been working on from my development environment to UAT. When the testers went in to test the new customizations, they noticed that duplicates were being introduced in the system (yet again). 
Sure enough, when I looked at the duplicate detection rules, they were unpublished (again). This time, I knew I'd published them previously and investigated more deeply. I discovered this is expected behavior. By design, whenever any entity metadata is changed all duplicate rules associated with that entity are unpublished.
  so after changing the meta data or any changes in schema solution we need to publish the duplicate detection rule again.

Supress the Duplicate detection rule

// Connect to the Organization service. 
// The using statement assures that the service proxy will be properly disposed.
using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig))
{
    // This statement is required to enable early-bound type support.
    _serviceProxy.EnableProxyTypes();

    _service = (IOrganizationService)_serviceProxy;

    CreateRequiredRecords();

    // Create and account record with the named Proseware, Inc. and already existing Account Number.
    Account account = new Account 
    {
        Name = "Proseware, Inc.",
        AccountNumber = "ACC005"
    };

    // Create operation by suppressing duplicate detection
    CreateRequest reqCreate = new CreateRequest();
    reqCreate.Target = account;
    reqCreate.Parameters.Add("SuppressDuplicateDetection", true); // Change to false to activate the duplicate detection.
    CreateResponse createResponse = (CreateResponse)_service.Execute(reqCreate);
    _dupAccountId = createResponse.id;
    Console.Write("Account: {0} {1} created with SuppressDuplicateDetection to true, ", 
        account.Name, account.AccountNumber);
    
    // Retrieve the account containing with its few attributes.
    ColumnSet cols = new ColumnSet(
        new String[] { "name", "accountnumber"});

    Account retrievedAccount = (Account)_service.Retrieve("account", _dupAccountId, cols);
    Console.Write("retrieved, ");

    // Update the existing account with new account number.
    retrievedAccount.AccountNumber = "ACC006";                   

    // Update operation – update record, if a duplicate is not found.
    UpdateRequest reqUpdate = new UpdateRequest();
    reqUpdate.Target = retrievedAccount;
    reqUpdate["SuppressDuplicateDetection"] = false; // Duplicate detection is activated.

    // Update the account record.
    UpdateResponse updateResponse = (UpdateResponse)_service.Execute(reqUpdate);
    Console.WriteLine("and updated.");

    DeleteRequiredRecords(promptforDelete);
}

Sunday, 11 August 2013

Upgrading an existing Microsoft Dynamics CRM 4.0 deployment to Microsoft Dynamics CRM 2011



Steps for upgrading an existing Microsoft Dynamics CRM 4.0 deployment to Microsoft Dynamics
CRM 2011.
A major consideration in Microsoft Dynamics CRM 2011 is that it is only available in 64-bit editions. This means a simple upgrade on the same computer is not possible for installations of 32-bit editions of Microsoft Dynamics CRM 4.0.



Upgrade Method
Features
Consideration
In-Place
An existing Microsoft Dynamics CRM 4.0 server is
upgraded to Microsoft Dynamics CRM 2011. Program files
and the configuration and default organization databases
are upgraded.
Microsoft Dynamics CRM 4.0 Server and SQL Server
must meet installation requirements
Does not require new hardware
Simplest to perform
Harder to recover from failure
Only the default organization is upgraded
Other Microsoft Dynamics CRM 4.0 organizations must
be imported
Connect to
existing
deployment
Microsoft Dynamics CRM 2011 is installed on a new
server. During installation, the Connect to, and if
necessary, upgrade an existing deployment option is
chosen. The Microsoft Dynamics CRM 4.0 configuration
and default organization databases are upgraded during
installation.
Requires additional hardware for the Microsoft
Dynamics CRM 2011 Server
May require a new SQL Server or new instance of SQL
Server
The Microsoft Dynamics CRM 4.0 Server is unaffected
Only the default organization is upgraded
Other Microsoft Dynamics CRM 4.0 organizations must
be imported
Failure of upgrade requires a restore of the Microsoft
Dynamics CRM 4.0 databases
Migration
Microsoft Dynamics CRM 2011 is installed on a new
server. Setup creates a new configuration database on a new
SQL Server or on a new instance on the existing SQL
Server. After Setup is completed, the Microsoft Dynamics
CRM 4.0 organization databases are imported and
upgraded into the new deployment using the Import
Organization Wizard.
Requires additional hardware for the Microsoft
Dynamics CRM 2011 Server
Requires a new SQL Server or new instance of SQL
Server
The Microsoft Dynamics CRM 4.0 production system is
maintained until the final migration
The Microsoft Dynamics CRM 4.0 Server is not affected
Each Microsoft Dynamics CRM 4.0 organization must
be imported using the Import Organization Wizard in the
Deployment Manager
During the final migration, only the organization
database has to be upgraded, reducing downtime
Useful for establishing a test environment
 

Components Installed During Server Setup

Web component:


Application
Pool
CRMAppPool(Microsoft Dynamics CRM Server
Setup creates a separate application
pool for the Microsoft Dynamics CRM
application.)
Application
Pool
CRMDeploymentSe
rviceAppPool(Microsoft Dynamics CRM Server
Setup creates a separate application
pool for the Deployment Web Service.)
Website
Mscrm website
Applications
XRMDeployment
 




Default folder

SystemDrive:\Program Files\Microsoft
Dynamics CRM\
Microsoft Dynamics CRM Server
program files
SystemDrive:\Program Files\Microsoft
Dynamics
CRM\LangPacks\<LanguageID>\Repo
rts\MSCRM
Contains a Microsoft Dynamics
CRM subfolder that contains an .rdl
file for each default report
SystemDrive:\Program Files\Microsoft
Dynamics CRM\LangPacks
Language pack
SystemDrive:\Program Files\Microsoft
Dynamics CRM\Trace
trace
SystemDrive:\Program Files\Microsoft
Dynamics
CRM\CRMWeb\CRMReports
Report service