serving the solutions day and night

Pages

Monday, March 18, 2013

Dynamics CRM Import Solution Failure

Failure Error:- An item with the same key has already been added.

Because of "duplicate field names", there are 2 possible causes.
1)Duplication has occurred between a custom field, and a virtual field

CRM creates an additional attribute in the metadata for the text of the field for certain field types (boolean, picklist and lookup). This attrbiute is not physically stored, and is considered to be a 'virtual' field. The virtaul attribute has the name of the base field + a suffix of 'name'.
For example,
the addresstypecode picklist field  => addresstypecodename virtual field
new_parentcustomerid custom lookup field  => new_parentcustomeridname virtual field.

CRM will let you do this, but the import could fail.

The following script will list of any duplicates, run in the METABASE database

select
    e.name as entity, a.name as attribute, count(*)
from
    attribute a join entity e on a.entityid = e.entityid
group by
    e.name, a.name
having count(*) > 1

Saturday, March 16, 2013

Dynamics CRM Plugin Registration Tool

Download and Export
  1. Download and install latest Dynamics CRM SDK  from Microsoft.
  2. Export "pluginprofiler.solution" package (get it from sdk\bin) to your CRM solution.
Connect to the Microsoft Dynamics CRM Server
  1. Run the PluginRegistration.exe tool from sdl\bin folder of the SDK download.
  2. To run the Plug-in Registration tool, you must first install the Windows Identity Foundation
  3. Click Create New Connection.
  4. Click connect to the Microsoft Dynamics CRM Server, you should see a list of available organizations that you belong to in the Connections pane.

Friday, March 15, 2013

ILMerge

Download ILMerge from MicroSoft

"$(Programfiles)\Microsoft\ILMerge\ilmerge.exe” /out:$(TargetDir)$(AssemblyName).Merged.dll $(TargetDir)DNS.Crm.Activities.dll $(TargetDir)DNS.Crm.Entities.dll  $(TargetDir)DNS.Crm.BusinessLogic.dll /keyfile:$(TargetDir)DNSCRM.snk /targetplatform:v4,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /log:$(AssemblyName).ILMerge.log

"C:\Program Files (x86)\Microsoft\ILMerge\ilmerge.exe” /out:$(TargetDir)$(AssemblyName).Merged.dll $(TargetDir)$(AssemblyName).dll $(TargetDir)BizTalk.MSDynamicsCRM2011.DNS.Entities.dll /keyfile:$(TargetDir)CRM.BookAudit.snk /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /log:$(AssemblyName).ILMerge.log

Past the above code in the post-build event command line:

 

Wednesday, March 13, 2013

SQL Server Shrink Log File

SELECT name,recovery_model_desc FROM sys.databases
GO 

 Step 1
ALTER DATABASE <Your Database Name> SET RECOVERY SIMPLE; 
ALTER DATABASE WSS_Proposal_Content SET RECOVERY SIMPLE;

Step 2
DBCC SHRINKFILE (<Your Database Name>_log, 5); 
DBCC SHRINKFILE (WSS_Proposal_Content_log, 5);

Step3
ALTER DATABASE <Your Database Name> SET RECOVERY FULL; 
ALTER DATABASE WSS_Proposal_Content SET RECOVERY FULL;


Database 1
Alter database SharePoint_Config set Recovery simple
GO

USE [SharePoint_Config]
GO

DBCC SHRINKFILE (N'SharePoint_Config_log' , 50)
go

Alter database SharePoint_Config set Recovery full
GO


Database 2
Alter database WSS_SESProposal_Content set Recovery simple
GO

USE [WSS_SESProposal_Content]
GO
DBCC SHRINKFILE (N'WSS_SESProposal_Content_log',50)
go

Alter database WSS_SESProposal_Content set Recovery full
GO


Database 3
Alter database WSS_Search_Content set Recovery simple
GO

USE [WSS_Search_Content]
GO
DBCC SHRINKFILE (N'WSS_Search_Content_log',50)
go

Alter database WSS_Search_Content set Recovery full
GO

Find Logical File Name
Declare @LogFileLogicalName sysname
select @LogFileLogicalName=Name from sys.database_files where Type=1
print @LogFileLogicalName