Thursday, July 23, 2015

HowTo: Make CRM Developer Toolkit & ILMerge work together

Just a quick note. Following post-build script automates merging of custom assemblies you’ve references in your code and the same time allows CRM Developer Toolkit to pick-up merged assembly for deployment:
mkdir "$(TargetDir)Merged" 
"$(SolutionDir)ILMerge/ilmerge.exe" /keyfile:"$(ProjectDir)key.snk" /target:library 
    /copyattrs /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" 
    /out:"$(TargetDir)Merged\$(TargetFileName)" "$(TargetDir)$(TargetFileName)" 
    "$(TargetDir)Microsoft.Web.Services2.dll" /lib:"$(ProjectDir)bin\debug"
del "$(TargetDir)$(TargetFileName)" /Q
move "$(TargetDir)Merged\*.*" "$(TargetDir)"


Of course to use it you have to point script to ILMerge executable, your strong name file and add assemblies you’ve used.

Wednesday, July 22, 2015

HowTo: Avoid simultaneous execution of 2 instances of same workflow for a record

Let’s imagine that you (as a consultant) use waiting workflows (booo, I know that waiting workflows are evil). But let’s imagine and you have a field on a record that is responsible for datetime till when workflow has to wait to proceed. Obviously that change of a datetime field should lead to change of workflow “waiting to proceed” time. But you can’t apply this change to workflow that is triggered already. So to complete the task you have to kill existing instance of a workflow and run new. This article describes custom workflow activity that does the trick.

Wednesday, March 11, 2015

Business Process Flow and Bulk Update of Process and Stage

Let’s imagine following situation – customer decided to use Business Process Flow for one of entities that already existed in CRM. You designed required BPF and everything looks great for new records. But what to do with existing records? Obvious answer is that you need somehow to update existing records. This article will show how to do it in easy and almost no-code way.

Sunday, March 01, 2015

HowTo: HTML/JS WebResources

We (developers) have got great feature with CRM 2011 release. If you want to give your CRM application new client side features or controls that are not available OOB on one hand and you want your solution remain supported you have to use HTML/JS webresources. This article will describe approaches, tricks and code snippets I’ve fount or developed during my usage of HTML/JS webresources.

Wednesday, January 07, 2015

HowTo: Open standard lookup window and get selected record(s)

If you are apologist of 100% supported solutions for Dynamics CRM this is a good place to close this article because it describes approach that will allow to open standard lookup dialog window of CRM and get selected values from it. Of course that customization is unsupported.

Saturday, January 03, 2015

MVP Renewed – 5

Sixth year in a row I have got MVP award. Congratulations to all MVP's who has got award first time or was re-awarded.

Thursday, December 25, 2014

Microsoft CRM 2015 and OData queries builders

Since OData endpoint was released with CRM 2011 I used CRM OData Query Designer developed by MVP fellow Rhett Clinton. Today I was working on brand new online instance of CRM 2015 and… I was not able to import lovely tool into CRM with message that solutions developed for CRM 2011 could not be imported into CRM 2015. I started to look for alternatives and found brilliant solution developed by other MVP fellow – Jason Lattimer. The great advantage of CRM REST Builder is that you can get complete code of calls using different frameworks developed for Dynamics CRM. So try, use and love this tool – CRM REST Builder.

Wednesday, October 08, 2014

Microsoft CRM 2013: Currency exchange rates actualization

In this article I will share with small add-on I developed for one of my customers.
Let’s assume that you are employee of company that uses CRM with several currencies. Of course you want to have actual information in your system and currency exchange rates should be current. Microsoft CRM allows to have in system one base currency and many other currencies. Every currency has exchange rate field that is used for calculation of base fields of your currency fields but there is no out-of-box possibility to actualize exchange rates.

Saturday, September 27, 2014

Reporting for Dynamics CRM: Error while loading code module: “Microsoft.Crm.Reporting.RdlHelper…”

Let’s assume that you’ve created report for Dynamics CRM using Report Wizard and opened it with BIDS to add changes that are not available with Report Wizard (it could be anything – adding of images, change of fonts or layout…).
Once you’ve opened a report and applied change of course you want to recheck changes. In case you will get error that is shown on following screenshot you can find steps that will allow to build and test report in BIDs without any issues:

Friday, June 13, 2014

Dynamics CRM 2013: Step-by-step creating dialog windows

In my previous post I shared how to use Microsoft CRM internal function to show dialog window in Dynamics CRM 2013 inline style. In this post I will write step-by-step guide how to build own dialogs in CRM 2013 style.

Monday, May 26, 2014

Show your dialog in CRM 2013 modal style

With CRM 2013 we have got one working window without any pop-up windows (lookups, dialogs, e.t.c.). But… only for standard features. What to do in case you wanted to use the same approach with modal windows as CRM does it? I walked through SDK and found following article - http://msdn.microsoft.com/en-us/library/jj602956.aspx#BKMK_OpenWebResource. I tried the code but I have got wrapped window.open method. After some investigations I found how CRM does it:
if (typeof Custom == "undefined") {
    Custom = {
        OpenDialog: function (webresource) {
            var $v_0 = new Mscrm.CrmDialog(Mscrm.CrmUri.create(webresource), window, 370, 370, null);
            $v_0.show();
        },
        __namespace: true
    };
}


and usage is following:

Custom.OpenDialog("/webresources/new_webresource.htm");

Demonstration of how it looks like:



You can use this approach but remember that this code uses undocumented methods so it could be broken with any rollup.

Tuesday, February 18, 2014

MVP – 2

At least I have received all packages from Microsoft and put all parts together. It looks awesome:


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.

Wednesday, January 22, 2014

MS CRM 2013: How to fix ‘sdkmessage With Id = {} Does Not Exist’ error

This error appears when you are trying to import solution that contains plugin(-s) that handle Action(-s) from one environment to other environment:


In Log file and trace file you can find description of error similar to following:
sdkmessage With Id = a79cef5c-dd82-e311-a344-0800272ad985 Does Not Exist

Source of issue is that Ids of SdkMessage

This issue is well-known, registered on Connect but haven’t been fixed yet.

This article describes workaround that will allow to import such solution.

Sunday, January 19, 2014

MS CRM 2013: Issues uploading report to CRM Online

Today I faced with really weird issue with Report developed for CRM Online. Report worked fine both at BIDS and my test On-Premise instance but once I’ve tried to upload it to productive instance I have got following error:


I’ve downloaded description file but error log didn’t contain any helpful information:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: 
An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator.Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ErrorCode>-2147188072</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again.
    If this problem persists, contact your system administrator.</Message>
  <Timestamp>2014-01-19T20:15:50.4036673Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

After that I’ve opened SDK for CRM and found this article that describes limitations of reports in CRM Online. I went through all used formulas and replaced parts that used Equals and Decimal.Zero.

So my suggestion in case you have problems uploading report to CRM Online:

1. Recheck that your report uses Fetch Xml DataSource.
2. Recheck all formulas that you have in your report and remove (or replace) all denied types and denied members.
3. Ensure that your report doesn’t use references to any assemblies.

Sunday, January 12, 2014

MS CRM 2011/2013: Open new email form with To and Regarding fields prefilled

About a year ago I wrote small article how to open new activity form with Regarding field prefilled.
This week I had a similar task but this time I had to write a JavaScript that will open email form with To field prefilled. So here is the script that you can use:
function OpenEmail(recordid, recordtypecode) {
    var params = "pId=" + recordid + "&pName=&pType=" + recordtypecode;
    params += "&partyid=" + recordid + "&partyname=&partytype=" + recordtypecode;
    var url = "/main.aspx?etc=4202&pagetype=entityrecord&extraqs=" + encodeURIComponent(params);
    url = Xrm.Page.context.prependOrgName(url);
    window.open(url);
}

Here is sample of usage:

OpenEmail("c8576fa9-155e-e311-bbc5-6c3be5a8d218", 2);

This small JavaScript will open new email form with Regarding and To fields prefilled with contact with Id that equals to "c8576fa9-155e-e311-bbc5-6c3be5a8d218".

Thursday, January 09, 2014

Microsoft CRM 2011/2013: Colorizing Service Calendar

This is how standard service calendar looks like:

Today I was asked with customer is it possible to change colorizing schema of Service Calendar. I started to look for information about it and found following article - http://msdn.microsoft.com/en-us/library/gg309501.aspx
Unfortunately I was not able to understand now to make it from first attempt and I contacted Microsoft to get some clarification and help. I’m really appreciated to Jim Daly who got in touch with me and gave some explanations regarding SDK article. I will share with results I've got in this article.

Friday, January 03, 2014

MVP Renewed – 4

Fifth year in a row I have got MVP award. Congratulations to all MVP's who has got award first time or was re-awarded.

Monday, November 04, 2013

Microsoft CRM 2013 - Integration with BingMaps: difference between OnPremise and Online instances

Difference I faced today is following – OnPremise instance has Bing Map api key field in System Settings but Online doesn’t.

OnPremise:
OnLine:
 

Thursday, October 31, 2013

Microsoft CRM 2013: Adding standard Bing Map control to forms of custom entities

In CRM 2013 Microsoft released really great feature – OOB integration with BingMaps. Unfortunately list of entities that support BingMaps control is limited to Account, Contact, Lead, Quote, Order, Invoice, Competitor and System User.
I did small investigation how this control is organized and I can confirm that it is possible to add OOB Bing Maps control to forms of custom entities. But be careful -  provided solution is 100% unsupported but doesn’t require any knowledge of development, JavaScript, HTML and so on.