Tuesday, 20 June 2017

Action Microsoft.Crm.Setup.Common.Analyzer +CollectAction failed. Fatal error during installation

When installing the Srs Data Connection (Microsoft Dynamics CRM Reporting Extensions), you may have experienced the following error:


"Action Microsoft.Crm.Setup.Common.Analyzer +CollectAction failed. Fatal error during installation OR Action Microsoft.Crm.Setup.Common.Analyzer+CollectAction failed. Fatal error during installation"

There are more than one option that you can use to fix this issue.

Solution 1

1. Check that you don't already have a version of the Srs Data Connector installed, if yes then uninstall, reboot and retry the install.

Solution 2

1. Open RegEdit and navigate to the following (please note that the GUID will vary depending on your CRM version)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\AA525E7FC7F524344B2B2650A4C6D64

2. Delete the key and Restart the Server.
3. Retry the Srs Data Connector install.

Solution 3

1. Download the latest Microsoft Dynamics CRM Server install files and attempt the install using the Srs Data Connector found within this build. This solution works if the first two did not.

Tuesday, 2 May 2017

SQL Server Reporting Services Account is a local user and is not supported

When installing the SQL Reporting Extensions for Microsoft Dynamics CRM, you may get the "SQL Server Reporting Services Account is a local user and is not supported" error.

This is easily resolved by changing the service account that the Reporting Service is using.
1. Open the Reporting Services Configuration Manager

2. Set the service account to use a dedicated account rather than the default "Report Server"

3. Shutdown the installer and then re-run, you should now see that it works fine. 


Sunday, 23 April 2017

MS CRM 2016 Install - Step by Step Instructions

Step by step instruction on how to install the latest version of Microsoft Dynamics CRM 2016 on-premise.

1. Click on the first option to trigger the server installation process. 


2. You can optionally check for updated installation components and then click next.


3. Enter your CRM License Key and click Next


4. You can change the installation directory, however I tend to leave this as the default.


5. Check which roles you want installed, as I am building a single VM I have selected both front end, back end and deployment services.


6. Ensure you have the first option selected and then specify the SQL Server you want to use for this installation. The required version of SQL is 2014 or above.


7. Browse and select the OU you want this system to reside and click next.


8. Set the service account details for each of the services, these will vary depending on which roles you selected in the previous roles selection dialog. You will also note that these are the same services from CRM 2013 and CRM 2015.


9. Specify your Organisation details and click continue.



10. After clicking next, the installation wizard will perform some checks. In most cases if you have not set the correct permissions for the service accounts, you will see something similar to the screen shot below.



It is just stating that the Application and Async service accounts need access to the performance log. To rectify this, just add the accounts to the "Performance Log Users" security group.

11. Then click the back button and then the next button to re-perform the checks. You should now see that the errors have gone. Click Next to continue.


12. Click Next on this screen, it is just to confirm that several services will be restarted.


13. Verify that you are happy with your selections and click next to perform the installation.


Note that you will need to install the reporting extensions, authoring tools and email router independently from the server install.

Thursday, 30 March 2017

How to reduce the size of the CRM Database

There are several tables within each CRM Organization database that can become very large. The size of the CRM database shouldn't be an issue within your production environment, as adequate space should be provisioned for this growth. 

These are as follows:

  • AsyncOperationBase
  • AuditBase
  • WorkflowWaitSubscriptionBase
  • PrincipleObjectBase

The problems typically occur in QA, UAT or DEV environments where you need to restore a prod like copy in order to work against real life data. Disk space can be a premium in these environments, thus having the ability to trim down the CRM database can be very useful.

You should leave the PrincipleObjectBase table alone as this deals with many aspects of record access, sharing etc.

Steps to Reduce your CRM Database size:

1. Execute the following SQL statement to remove redundant records from the AsyncOperationBase 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

while(1=1)
begin
declare @DeleteRowCount int = 10000
declare @rowsAffected int
declare @DeletedAsyncRowsTable table (AsyncOperationId uniqueidentifier not null primary key)
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, 32)

 select @rowsAffected = @@rowcount 
 delete poa from PrincipalObjectAccess poa 
   join WorkflowLogBase wlb on
    poa.ObjectId = wlb.WorkflowLogId
   join @DeletedAsyncRowsTable dart on
    wlb.AsyncOperationId = dart.AsyncOperationId
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 BulkDeleteOperationBase From BulkDeleteOperationBase O, @DeletedAsyncRowsTable d
where 
  O.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
/*If not calling from a SQL job, use the WAITFOR DELAY*/
if(@DeleteRowCount > @rowsAffected)
  return
else
  WAITFOR DELAY '00:00:02.000'

end

2. Execute the following SQL statement to remove redundant records from the WorkflowWaitSubscriptionBase table:

Delete from workflowwaitsubscriptionbase 
where asyncoperationid in(Select asyncoperationidfrom AsyncOperationBase
where OperationType in (1, 9, 12, 25, 27, 10) 

AND StateCode = 3 AND StatusCode IN (30,32))

3. Delete the Audit Log partitions from within the CRM User Interface. 

Go to Settings>Auditing and then click on Audit Log Management

Select and delete each partition, the larger ones are indicated by the number of rows.

3. Finally you need to Shrink the CRM Organization SQL Database itself from within SQL Management Studio. This will recover all available space within the database file and reduce it's footprint on disk.

The summary screen will indicate how much available space will be recovered, by which the database file size also being reduced by the same amount. Then click OK and wait for the process to finish.

Thursday, 21 January 2016

RetrievePrivilegeForUser failed - no roles are assigned to user

Hopefully you are fortunate enough to never experience this in the field, however when some smart aleck decides to add the CRM App Pool service account as an actual CRM System User. You will get an error similar to this:

Exception information: 
    Exception type: CrmException 
    Exception message: SecLib::RetrievePrivilegeForUser failed - no roles are assigned to user. Returned hr = -2147209463, User: b1eda2c8-dbbd-e511-b14d-0050569b5b86
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveMultipleCommand.Execute()
   at Microsoft.Crm.Application.Caching.CustomResourceLoader.GetCustomResources(IOrganizationContext context, Int32 cacheKey)
   at Microsoft.Crm.Application.Caching.CustomResourceLoader.LoadCacheData(Int32 key, IOrganizationContext context)
   at Microsoft.Crm.Caching.CrmMultiOrgCacheBase`2.LookupEntry(TKey key, IOrganizationContext context)
   at Microsoft.Crm.Application.ResourceManager.CustomResourceManager.TryGetCultureString(String name, CultureInfo culture, Boolean getSystemString, IOrganizationContext context)
   at Microsoft.Crm.Application.ResourceManager.CustomResourceManager.TryGetCultureString(String name, CultureInfo culture, IOrganizationContext context)
   at Microsoft.Crm.Application.ResourceManager.BasicResourceManager.GetCultureString(String name, CultureInfo culture, IOrganizationContext context)
   at Microsoft.Crm.Controls.Header..ctor(Boolean isControlHeader)
   at Microsoft.Crm.Controls.BasicHeader..ctor()
   at Microsoft.Crm.Application.Controls.AppHeader..ctor()
   at ASP.dynamicsqa_default_aspx.__BuildControlcrmHeader()
   at ASP.dynamicsqa_default_aspx.__BuildControlTree(dynamicsqa_default_aspx __ctrl)
   at ASP.dynamicsqa_default_aspx.FrameworkInitialize()
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The cause is due to the service account now existing as a CRM user. The service account is responsible for running and acting as the service identity for the CRM web application within IIS. This can have severe security implications, in this specific scenario users could no longer log into Dynamics CRM.

According to https://support.microsoft.com/en-us/kb/2593042 there are other issues that this can also introduce.

  • Data Import may fail
  • CRM Outlook Clients may not configure
  • Async Operations may have unexpected behavior including Workflows stopping with a Failed status
  • No users can access CRM
  • IFD access may fail for some or all users
  • Date/Time fields may not display correct timezone offset

The Fix
  1. Change the CRM service account, which will further involve creating new SPN's etc
  2. Remove the user from the CRM Sql Database, which is unsupported and will be very tricky to perform.
  3. In our case we resolved this by marking the specific accounts record as "IsDeleted" within the MSCRM_CONFIG.SystemUserAuthentication table


Friday, 8 January 2016

How to get the Object Type Code of an Entity?

Each system and custom entity within Dynamics CRM comes with an array of unique attributes. These include an Entity ID, Logical Name and Object Type Code. Identifying the logical name is pretty easy, however tracking down the rest can be a little tricky.

  • Custom entities will have a Object Type Code greater than 10000. You should also note that the OTC of a custom entity can change when importing the entity to a different system. This is likely when an existing entity on the target system is already using the OTC number.
  • Any system entities will use a Object Type Code less than 10000. This range is reserved for all built in entities.


Using SQL
Execute the following statement against the target CRM Organization database.

SELECT ObjectTypeCode,* FROM ENTITYVIEW 


Using JScript
You can access the "etc" query string parameter from the open entity window within CRM.

Xrm.Page.context.getQueryStringParameters().etc

Tuesday, 22 December 2015

MS CRM 2013 - Reporting Extensions Setup (Blank/Empty SSRS Instance)

When installing CRM 2013 Reporting Extensions, you may experience the "Empty SSRS Instance" dropdown on the second install wizard screen as displayed below:


This can be caused by any of the following reasons:

  • You are trying to install "Reporting Extensions" on the incorrect server, you should be running the installer on the SQL Server not the CRM Server.
  • SSRS is incorrectly configured, it is not configured or pointing to a Report Server database, a permisions or virtual directory issue. Try loading the Reports web page using IE to check that the Reporting URL can be reached.
  • You have installed an unsupported version of SQL Server
In my experience, the 3rd is the most likely cause where by an x86 version of SQL has been installed. Once you have resolved the cause, you should now see the SSRS instance within the dropdown:



Thursday, 16 July 2015

How to Identify AD Groups for CRM Organization

Each organization within MS CRM, will have there own set of unique groups within active directory. You can either pre-create these groups or allow the "Deployment Manager" to create these as part of the creation process.

Regardless which option you use, you should have the following 3 groups:

  • SqlAccessGroup
  • PrivReportingGroup
  • ReportingGroup

Eventually you will discover that active directory will soon become overun with these groups and it can become difficult to identify which groupds are associated with which CRM organization.


Being able to identify these groups is very useful when investigating permissions and security related issues. You can use a simple SQL query against the "Organization_MSCRM" database.

select ReportingGroupName, SqlAccessGroupName, PrivReportingGroupName from Organization




MS CRM - Sandbox Timeout

MS Dynamics CRM imposes several limitations and restrictions to all plugins registered to operate within the CRM Sandbox. 

The most common pitfall experienced by developers is the Sandbox Timeout, which by default is set to 2 minutes. Any business logic that executes longer than this will result in a exception e.g:
  • 0x80044172; message: The plug-in execution failed because the operation has timed-out at the Sandbox Host
  • 0x80044171; message: The plug-in execution failed because the operation has timed-out at the Sandbox Client
In order to increase the timeout period, there are several registry settings below which can be used as follows:
  • HKLM\Software\Microsoft\MSCRM\SandboxClientOperationTimeoutInSec
  • HKLM\Software\Microsoft\MSCRM\SandboxHostOperationTimeoutInSec
  • HKLM\Software\Microsoft\MSCRM\SandboxWorkerOperationTimeoutInSec
The screenshot below shows the three registry settings, by default they are all set to 120 seconds (2 minutes). Changing these settings can be used to either decrease or increase the sandbox timeout.






Wednesday, 1 October 2014

Microsoft Dynamics CRM Reporting Extensions Error - Requested value ‘Geo’ was not found

When attempting the SRS Data Connector Installation, you may encounter the following error:


The error is Microsoft.Crm.Setup.SrsDataConnector.RegisterServerAction failed.
Requested value ‘Geo’ was not found

Solution
To fix this issue and complete the installation, follow these steps:

  1. Download CRM 2011 Update Rollup 6
  2. Install the SrsDataConnector that came with your CRM ISO. Click the Cancel button when the error message appears.
  3. Install the SrsDataConnector from the UR 6 download
  4. Go to the directory where the SRS Data Connector is installed e.g. C:\Program Files\Microsoft Dynamics CRM Reporting Extensions
  5. Start SetupSrsDataConnector.exe, select Repair and click Next



Tuesday, 30 September 2014

Microsoft Dynamics CRM Reporting Extensions Install Error

You may receive this error when trying to install the Microsoft Dynamics CRM Reporting Extensions (SSRS Data connector):

A Microsoft Dynamics CRM Server component is using the same account as the instance of SQL Server Reporting Services

Solution
Add a new Registry key to the computer that is running the SSRS Data Connector installation:

  1. Start, Click Run, type regedit, and then click OK.
  2. In the registry, find: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM
  3. Right click MSCRM, and create a new DWORD Value with the name IgnoreChecks
  4. Double click IgnoreChecks, and enter 1 in the Value data field.

Monday, 31 March 2014

Update Organization Error - Microsoft.Crm.CrmException: Update Organization with Id=

Installing a Microsoft Dynamics CRM Rollup is an integral part of maintaining your system. However there are issues you may experience after you have completed the install, such as:

  • issues trying to launch CRM, which are now displaying an error message that isn't very useful.
  • importing a solution

Often the reasons for this is that the Organization itself has not been successfully upgraded. You can verify this by launching the Deployment Manager and checking the version as displayed below:

If you find that the version is incorrect, then you can right click on the specific Organization and use the Update option. At this point you may find yourself with a second issue, whereby the update itself is now failing:
Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction failed. InnerException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added.

To remedy this, connect to the Organization's SQL Database using SQL Management Studio and execute the following script:

declare @IncidentOptionSetId uniqueidentifier = '7779161B-0E32-4001-8D44-339C2D1FF1F0'
declare @IncidentSystemPicklistIdFor1000 uniqueidentifier = 'DE3D1468-D2F4-4BC6-8BF6-73C5C64C435D'
declare @IncidentPicklistValueFor1000 int = 1000

declare @CategoryOptionSetId uniqueidentifier = '3041D03C-4166-4814-A2D4-1E3D93CAF2F1'
declare @CategorySystemPicklistIdFor1000 uniqueidentifier = 'ECBEE2BC-BAD2-4723-8612-371B4CE8D9E5'
declare @CategorySystemPicklistIdFor1001 uniqueidentifier = 'DE121D28-F5DF-45F7-B6FC-E97B1604F747'
declare @CategorySystemPicklistIdFor1002 uniqueidentifier = '8612EA04-81CF-423B-ADF4-EF74EEA70A41'
declare @CategoryPicklistValueFor1000 int = 1000
declare @CategoryPicklistValueFor1001 int = 1001
declare @CategoryPicklistValueFor1002 int = 1002
declare @CategoryPicklistValueFor6 int = 6
declare @CategoryPicklistValueFor7 int = 7
declare @CategoryPicklistValueFor8 int = 8

declare @SystemSolutionId uniqueidentifier = 'FD140AAD-4DF4-11DD-BD17-0019B9312238'
declare @AttributePicklistValueLabelTypeCode int = 2
declare @AttributePicklistValueSolutionComponentType int = 4
declare @DeleteComponentState int = 2

declare @PicklistIdMapping table
(
OldId uniqueidentifier,
NewId uniqueidentifier
)

delete @PicklistIdMapping
insert into @PicklistIdMapping (OldId, NewId)
 select AttributePicklistValueId, NULL
 from MetadataSchema.AttributePicklistValue 
 where 
  Value = @CategoryPicklistValueFor6 and AttributePicklistValueId = @CategorySystemPicklistIdFor1000
  or Value = @CategoryPicklistValueFor7 and AttributePicklistValueId = @CategorySystemPicklistIdFor1001
  or Value = @CategoryPicklistValueFor8 and AttributePicklistValueId = @CategorySystemPicklistIdFor1002
  -- do not include incident status picklist in here 
 group by AttributePicklistValueId 
 having COUNT(*) = 1


delete MetadataSchema.LocalizedLabel 
from
 MetadataSchema.LocalizedLabel l
 inner join @PicklistIdMapping m on l.ObjectId = m.OldId
 where l.LabelTypeCode = @AttributePicklistValueLabelTypeCode


delete DependencyBase where DependentComponentNodeId in 
(
 select DependencyNodeId 
 from 
  DependencyNodeBase d
  inner join @PicklistIdMapping m on d.ObjectId = m.OldId
  where d.ComponentType = @AttributePicklistValueSolutionComponentType
)

delete DependencyNodeBase 
from 
 DependencyNodeBase d
 inner join @PicklistIdMapping m on d.ObjectId = m.OldId
 where d.ComponentType = @AttributePicklistValueSolutionComponentType


delete MetadataSchema.AttributePicklistValue 
from 
 MetadataSchema.AttributePicklistValue a
 inner join @PicklistIdMapping m on a.AttributePicklistValueId = m.OldId


delete @PicklistIdMapping
insert into @PicklistIdMapping (OldId, NewId)
 select AttributePicklistValueId, NEWID() 
 from MetadataSchema.AttributePicklistValue 
 where 
  Value = @CategoryPicklistValueFor6 and AttributePicklistValueId = @CategorySystemPicklistIdFor1000
  or Value = @CategoryPicklistValueFor7 and AttributePicklistValueId = @CategorySystemPicklistIdFor1001
  or Value = @CategoryPicklistValueFor8 and AttributePicklistValueId = @CategorySystemPicklistIdFor1002
  -- do not include incident status picklist in here 
 group by AttributePicklistValueId 
 having COUNT(*) > 1

update MetadataSchema.LocalizedLabel
set ComponentState = @DeleteComponentState
from 
 MetadataSchema.LocalizedLabel l
 inner join @PicklistIdMapping m on l.ObjectId = m.OldId
 where l.SolutionId = @SystemSolutionId and l.LabelTypeCode = @AttributePicklistValueLabelTypeCode

update MetadataSchema.AttributePicklistValue 
set ComponentState = @DeleteComponentState
from 
 MetadataSchema.AttributePicklistValue a
 inner join @PicklistIdMapping m on a.AttributePicklistValueId = m.OldId
 where a.SolutionId = @SystemSolutionId

update MetadataSchema.LocalizedLabel 
set ObjectId = m.NewId 
from
 MetadataSchema.LocalizedLabel l
 inner join @PicklistIdMapping m on l.ObjectId = m.OldId
 where l.LabelTypeCode = @AttributePicklistValueLabelTypeCode

update DependencyNodeBase 
set ObjectId = m.NewId
from 
 DependencyNodeBase d
 inner join @PicklistIdMapping m on d.ObjectId = m.OldId
 where d.ComponentType = @AttributePicklistValueSolutionComponentType

update MetadataSchema.AttributePicklistValue 
set AttributePicklistValueId = m.NewId 
from 
 MetadataSchema.AttributePicklistValue a
 inner join @PicklistIdMapping m on a.AttributePicklistValueId = m.OldId

delete @PicklistIdMapping
insert into @PicklistIdMapping (OldId, NewId)
 select AttributePicklistValueId OldId,
  CASE Value
   WHEN @CategoryPicklistValueFor1000 THEN @CategorySystemPicklistIdFor1000
   WHEN @CategoryPicklistValueFor1001 THEN @CategorySystemPicklistIdFor1001
   WHEN @CategoryPicklistValueFor1002 THEN @CategorySystemPicklistIdFor1002
  END NewId
 from AttributePicklistValueView
 where OptionSetId = @CategoryOptionSetId and Value in (@CategoryPicklistValueFor1000, @CategoryPicklistValueFor1001, @CategoryPicklistValueFor1002)

delete from @PicklistIdMapping where OldId in (@CategorySystemPicklistIdFor1000, @CategorySystemPicklistIdFor1001, @CategorySystemPicklistIdFor1002)

insert into @PicklistIdMapping (OldId, NewId)
 select AttributePicklistValueId OldId, @IncidentSystemPicklistIdFor1000 NewId
 from AttributePicklistValueView
 where OptionSetId = @IncidentOptionSetId and Value = @IncidentPicklistValueFor1000
delete from @PicklistIdMapping where OldId = @IncidentSystemPicklistIdFor1000 

update MetadataSchema.LocalizedLabel 
set ObjectId = m.NewId 
from
 MetadataSchema.LocalizedLabel l
 inner join @PicklistIdMapping m on l.ObjectId = m.OldId
 where l.LabelTypeCode = @AttributePicklistValueLabelTypeCode

update DependencyNodeBase 
set ObjectId = m.NewId
from 
 DependencyNodeBase d
 inner join @PicklistIdMapping m on d.ObjectId = m.OldId
 where d.ComponentType = @AttributePicklistValueSolutionComponentType

update MetadataSchema.AttributePicklistValue 
set AttributePicklistValueId = m.NewId
from 
 MetadataSchema.AttributePicklistValue a
 inner join @PicklistIdMapping m on a.AttributePicklistValueId = m.OldId


After executing this script, try again and the Organization should not update successfully, which in return should resolve your CRM launching and solution import issues. 

Hope this helps?

Action Microsoft.Crm.Setup.Common.Analyzer +CollectAction failed. Fatal error during installation

When installing the Srs Data Connection (Microsoft Dynamics CRM Reporting Extensions), you may have experienced the following error: ...