Showing posts with label T-SQL. Show all posts
Showing posts with label T-SQL. Show all posts

Monday, February 10, 2014

MS CRM 2013: OOB BingMaps control shows ‘click here to view map’ – what to do?

This article can help you to activate this feature for On Premise deployment only! This would not work for Online!
If you see something similar when you open your CRM Organization that means that for some reason MS decided to limit your possibility to see location of contact, account or other record on map:

To fix it do following steps:
1. Connect to SQL Server where DBs are located.
2. Open SQL Management Studio and execute following query against your CRM DB:


Select LocaleId From Organization

That will give you locale code of your organization. Now you need to convert this value to culture name (for example using this post) – in my case ru-RU.

3. Execute following query against MSCRM_Config DB:

Select NVarCharColumn From ServerSettingsProperties Where ColumnName = 'AvailableBingMapLocales'

That will give you the list of locales for which BingMaps would work (in my case it was cs-CZ;da-DK;nl-BE;nl-NL;en-AU;en-CA;en-IN;en-GB;en-US;fi-FI;fr-CA;fr-FR;de-DE;it-IT;ja-JP;nb-NO;pt-BR;pt-PT;es-MX;es-ES;es-US;sv-SE).

4. Write and execute script to update list of locales using following template:

Update ServerSettingsProperties
Set NVarCharColumn = 'Value from step 3;Value from step 2'
Where ColumnName = 'AvailableBingMapLocales'

In my case:

Update ServerSettingsProperties
Set NVarCharColumn = 'cs-CZ;da-DK;nl-BE;nl-NL;en-AU;en-CA;en-IN;en-GB;en-US;fi-FI;fr-CA;fr-FR;de-DE;it-IT;ja-JP;nb-NO;pt-BR;pt-PT;es-MX;es-ES;es-US;sv-SE;ru-RU'
Where ColumnName = 'AvailableBingMapLocales'

5. Make iisreset and try to open form where bingmaps was not shown before. If you’ve done everything right map had to appear:



PS This modifications are unsupported and mentioned changes can harm your deployment. Use it own risk.

Monday, February 18, 2013

Migrating contacts and accounts from Goldmine to Microsoft CRM 2011

I just finished a project where I had to migrate data from Goldmine to Microsoft CRM 2011 so I decided to share with my results.

Monday, January 21, 2013

MS CRM 2011: Add new Deployment Administrator through SQL

Here is just short script that has to be executed against MSCRM_Config db to add new deployment administrator:

Declare @DomainName Varchar(Max)
Set @DomainName = 'Put new deployment admin login here'--i.e. 'Contoso\Administrator'

Declare @Id uniqueidentifier
Select @Id = Id From mscrm_config..SystemUser Where Name = @DomainName

if (@Id is null)
Begin
    Set @Id = NEWID()
    INSERT INTO mscrm_config..SystemUser(Id, Name, DefaultOrganizationId) 
    VALUES(@Id, @DomainName, '00000000-0000-0000-0000-000000000000')
End

INSERT INTO mscrm_config..SystemUserRoles(Id, SecurityRoleId, SystemUserId) 
VALUES(NEWID(), (Select Id From mscrm_config..SecurityRole Where Name = 'Administrator'), @Id)


So the only thing you need to do is to put domain name of new deployment administrator in a format DOMAIN\Login like Contoso\Administrator.

This trick is 100% unsupported and can lead to malfunction of whole CRM deployment. I suggest you to take backup of MSCRM_Config DB before you run this script.

Monday, November 07, 2011

CRM 2011 - reports on data auditing

One of forum visitor asked about building reports based on Audited data. I have never worked with it in CRM 2011 so I decided to recheck how does it store information in DB. Confusing is wrong word for the feelings I've felt... Denormalized data which is impossible to analyse with SQL statements. Anyway following query can help you to build your own reports based on this information:

Sunday, August 28, 2011

Microsoft SQL - How to attach database having only mdf file

Quick trick - I had only mdf file of database without log file. Following t-sql script allowed me to attach mdf file to SQL:

sp_attach_single_file_db @dbname= 'NewDatabase', @physname= 'C:\Directory\DataBase.mdf'


After I ran this script I have got several messages but database was restored and worked fine.

Thursday, August 25, 2011

CRM 4.0 - supported way to use stored procedures in reports

It is written in SDK that it is possible to use Stored Procedures in reports and following article will describe how to do it.

Tuesday, April 13, 2010

CRM Usage Report

One of customer wanted to have the possibility to see who and when was working in CRM. I knew that MVP David Jennaway had created such solution based on IIS's logs. No matter how I tried - I failed to implement it. Logs weren't written to log database. Also this approach doesn't work in IFD deployment scenario.

So I left this idea and begun develop own solution.

Tuesday, January 05, 2010

Handling Rollup message with plugins in Microsoft Dynamics CRM 4.0

There are no Rollup message in the list of supported message in SDK. Following trick will help developers to handle this message.

Tuesday, August 18, 2009

Отображение денежных единиц в отчётах прописью

Этот пост пишу по-русски, потому что он может быть интересен только русскоязычным читателям.

При разработке отчётов-печатных форм счёта столкнулся с необходимостью выводить величину счёта буквами (125 руб. 50 коп надо было отобразить соответственно Сто двадцать пять рублей 50 копеек). Для этого, произведя поиск, нашёл и использовал следующие функции, которые могут пригодиться и Вам. Далее код: