Tuesday 29 April 2014

How to Debug Plugin in MSCRM 2011 On-Premise

The following steps describe how to debug a plug-in On-Premise :

Debug Synchronous Plugin in MSCRM 2011

  1.  First Build the Plug-in solution.
  2.   Register it on Plug-in registration tool
  3. While add assembly of Plug-in solution in PRT(Plugin Reg Tool), make sure “Disk” radio button must be checked and DLL of Plug-in should contain in “File Name In Server” text box.
  4. After Add assembly in PRT Copy .DLL and .PDB file of Plug-in from bin directory of our Plug-in.
  5. Paste both Copied file at below location :“C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly”
  6.  Go to Plug-in solution in Visual Studio 2012
  7. Add Debugger at specified location within code.
  8.  Attach process from Tools >Attach To Process > W3WP.exe > OK
  9.  Perform action for debugging Plug-in Solution
      
    Debug A-Synchronous Plugin in MSCRM 2011

            1   Firstly Build Plug-in solution
      2   Register it on Plug-in registration tool.
      3   Go to Plug-in solution in Visual Studio 2012
      4   Add Debugger at specified location within code.
      5   Attach process from 
                 Tools >Attach To Process >CrmAsyncService.exe(both) >OK
                6     Perform action for debugging Plug-in Solution









     



Plugin Assembly Table in MSCRM

One of my colleagues faced a situation where he had installed a plugin assembly into database but was not able to locate its DLL, and now he wanted to deploy it in some other server.

In MSCRM all plugins related information like its name, content, createdBy, createdOn. ModifiedBy, ModifiedOn etc store in PluginAssemblybase Table. You can get it by below Query result :
select * from PluginAssemblyBase
Below are some column description of PluginBaseTable :

Column Name
Description
Name
Store name of Plugin
Source Type     
Where the Plugin registered
       0 -      Database
       1 -      Disk
       2 -      GAC
content
Store content of DLL

These are the steps to get DLL from Content :

Get the encoded base 64 string representation of the plugin from PluginAssemblyBase table.

select name,content,*
from PluginAssemblyBase

Use that content and get the dll from the following site.


Set decode and export to binary file option there with filename having extension as .dll

Open the dll in the reflector tool and use the source code to build that assembly.


Monday 28 April 2014

Clean Up AsyncOperation(System Jobs) Table to Improve CRM Performance.

Today i am going to explain SQL Procedure Steps to cleanup MSCRM AsyncOperation table :

Asynchronous Operation States :

State
Status
Numeric status value
Ready
WaitingForResources
0
Suspended
Waiting
10
Locked
InProgress
20
Locked
Pausing
21
Locked
Canceling
22
Completed
Succeeded
30
Completed
Failed
31
Completed
Canceled
32

Step 1 : Create Index on specific column of AsyncOperation Table
IF EXISTS (SELECT name from sys.indexes
WHERE name = N'CRM_AsyncOperation_CleanupCompleted')
DROP Index AsyncOperationBase.CRM_AsyncOperation_CleanupCompleted
GO
CREATE NONCLUSTERED INDEX CRM_AsyncOperation_CleanupCompleted
ON [dbo].[AsyncOperationBase] ([StatusCode],[StateCode],[OperationType])
GO

Step 2 : Delete all Succeeded, Failed and Canceled Jobs
declare @DeleteRowCount int
Select @DeleteRowCount = 2000
declare @DeletedAsyncRowsTable table (AsyncOperationId uniqueidentifier not null primary key)
declare @continue int, @rowCount int
select @continue = 1
while (@continue = 1)
begin
begin tran
insert into @DeletedAsyncRowsTable(AsyncOperationId)
Select top (@DeleteRowCount) AsyncOperationId from AsyncOperationBase
where OperationType in (1, 9, 12, 25, 27, 10) AND StateCode = 3 AND StatusCode in (30,31,32)
Select @rowCount = 0
Select @rowCount = count(*) from @DeletedAsyncRowsTable
select @continue = case when @rowCount <= 0 then 0 else 1 end
if (@continue = 1) begin
delete WorkflowLogBase from WorkflowLogBase W, @DeletedAsyncRowsTable d
where W.AsyncOperationId = d.AsyncOperationId
delete BulkDeleteFailureBase From BulkDeleteFailureBase B, @DeletedAsyncRowsTable d
where B.AsyncOperationId = d.AsyncOperationId
delete WorkflowWaitSubscriptionBase from WorkflowWaitSubscriptionBase WS, @DeletedAsyncRowsTable d
where WS.AsyncOperationId = d.AsyncOperationID
delete AsyncOperationBase From AsyncOperationBase A, @DeletedAsyncRowsTable d
where A.AsyncOperationId = d.AsyncOperationId
delete @DeletedAsyncRowsTable
end
commit
end

Step 3 : Drop the Index on AsyncOperation Table
DROP INDEX AsyncOperationBase.CRM_AsyncOperation_CleanupCompleted

Saturday 26 April 2014

Overcome CRM Slowness and Optimization of Performance in Dynamics CRM 2011

Here is a checklist which can help you identify and reduce the issues with your client performance:
  • Optimize Your Form Load Experience.
  • Keep less fields on the form.
  • Do not overuse scripts (Avoid OnLoad; Use OnChange since its on demand).
  • Trim the ribbon appropriately.
  • Be wary of client side enabled rules. 
  • Use collapsed sections whenever possible.
  • Use server side show/hide fields.
  • Use ‘read optimized’ forms.
  • Use iFrames carefully, the more you have longer it takes to load.
  • Use Sub-grids, where necessary as it tend to increase page size quickly.
  • Manage the complexity and visualizations of dashboards.
Other than customizations,
  • Make sure you meet the minimum requirements for Hardware
  • Power settings can affect performance
  • Proxy server settings
  • Configure Internet Explorer for optimal performance: Configuring client-side browser caching and Configuring simultaneous download sessions
  • Extraneous processes, applications, and add-ins
  • Internet Explorer zoom setting
Blogger Widgets