Dupe Detection on Create/Update Returned to Dynamics CRM 2013…with a bug

Posted by on May 28, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2011,   |  Microsoft Dynamics CRM 2013,   |  Microsoft Dynamics CRM Online  |  commentsComments (1)

One of the biggest features removed when Microsoft Dynamics CRM 2013 was released was Duplicate Detection firing on creates/updates.  While duplicate detection remained via scheduling system jobs, the popular feature of seeing the pop-up appear on creates/updates was removed.

Needless to say the CRM community was in uproar, prompting some users and partners to create their own solutions to backfill the gap that was left by removing this 2011 feature such as this utility by Jason Lattimer.

With the Spring 2014 release that’s started to trickle out to CRM Online orgs, Microsoft has taken this community feedback and put duplicate detection on creates/updates back in.

image

However, be aware that while Microsoft has pleased many by making this functionality available once again, they didn’t quite get it right.  If you disable duplicate detection rules from running on creates/updates within the settings, the rules still fire and your users will still see the dialog when they create or update records that match a duplicate detection rule.

image

The only way to disable duplicate detection from firing on creates / updates is to uncheck the “Enable duplicate detection” checkbox which in turn disables it across the board (on data imports, from MS Outlook, and via scheduled system jobs).  Even if you uncheck “Enable duplicate detection” and recheck it (while leaving the creates/updates unchecked), after republishing your rules, the dialog will still fire on create and update. 

Note:  If you uncheck “Enable duplicate detection” and recheck it, you’ll have to republish your rules as disabling it system wide unpublishes all rules.

Hopefully Microsoft will release a patch soon for this slight oversight so that users can take full advantage of the duplicate detection feature as they did pre-CRM 2013.

Controlling Access to Access Team Templates

Posted by on May 23, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2013,   |  Microsoft Dynamics CRM Online  |  commentsComments (0)

One of the great new features of CRM 2013 is Access Teams.  Access Teams provides a great alternative over Sharing as Sharing should always be used as an exception and not the rule.  Too much sharing will lead to a large PrincipalObjectAccess (POA), which can lead to poor CRM performance.  This blog goes into details on recommendations to keep the POA table as small as possible.

For one of our customers we had a perfect scenario to use Access Team Templates.  The scenario is users should only have access to read their own records.  However, if they’re assigned a to-do that’s grouped together as part of a larger deliverable, they need to be able to see all details of that larger deliverable.  Therefore, adding them to the Access Team of the parent record with Read access, and allowing native CRM customizations to cascade that access down to the child records, the user is now able to see all data in this one grouping of work that they normally wouldn’t with normal security roles.

 

image

image

 

Access Teams are driven by the Access Team Templates (shown above, and available in Settings –> Administration –> Access Team Templates).

However, there’s something you should be aware of.  If the Access Team Template is ever deleted, all Access Teams that were created and use that template will be deleted from the system.  Therefore you need to provide tight security over who can create / update / delete Access Team Templates.

This is where the tricky part came in.  How do you drive permissions to Access Team Templates?  In native security roles there’s no “Access Team Template” or anything similar to that available in the list of entities or miscellaneous privileges.  So what drives this access?

Through painful trial and error, we identified the “not so obvious” Customizations entity (shown below) drives these permissions.  Therefore it’s recommended you remove Delete privileges to Customizations to prevent Access Team Templates from being deleted (for other obvious reasons as well).  Thankfully out of the box only the System Administrator and System Customizer roles have this privilege.

 

image

Big changes coming to the next major release of Dynamics CRM

Posted by on May 15, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2013,   |  Microsoft Dynamics CRM Online  |  commentsComments (0)

Yesterday Microsoft announced some big changes to the supported configurations for the next major release of CRM after the upcoming Service Pack 1 and Spring ‘14 release.  This time around Microsoft is being more aggressive than they have in the past when removing supported software. 

The biggest changes to support being the removal of the following CRM and SQL Server operating systems:

  • Windows Server 2008
  • Windows Server 2008 R2
  • Windows Small Business Server (All versions)
  • SQL Server 2008
  • SQL Server 2008 R2

As well as the removal of the following browser versions:

  • Internet Explorer 8
  • Internet Explorer 9

Some other notable changes are the removal of read-optimized forms and the 2007 SDK SOAP Endpoint that has been deprecated for awhile now.

It’s good to see Microsoft being more aggressive with future releases as they can focus more on providing the best product for the latest technology.  We also welcome the early communication as it gives customers a chance to prepare for the new changes.

If you have any questions or concerns about this announcement, head to our Contact Us page or post a comment below.  We would love to hear your thoughts.

Official announcement - http://blogs.msdn.com/b/crm/archive/2014/05/14/important-information-about-supported-configurations-in-the-next-major-release-for-crm.aspx

An interesting Activity Feeds quirk when customizing an entity’s ‘Follow’ views…

Posted by on May 12, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2013  |  commentsComments (0)

Today's guest blogger is Mike Dearing, a Senior Developer at Sonoma Partners

Do you use Activity Feeds / Yammer for your Dynamics 2013 organization?  If so, be advised that customizations to the ‘Follow’ views (‘<Entity Name> I follow’ and ‘<Entity Name> Being Followed’) don’t come over during a solution import. 

image

 

A colleague noticed this the other day when he had renamed the contact entity to a more industry-specific term for his client.  He then went through each view and changed the entity name there as well.  Unfortunately upon import of a solution containing this entity he noticed that the names for these 2 views in the target environment were still, ‘Contacts I Follow’ and ‘Contacts Being Followed’.  He ended up having to manually update the names of these views in the target environment to their correct names.

Intrigued by his plight, I spun up two online trial orgs and did some additional research.  It turns out that no changes actually come over on import for these ‘Follow’ views – including filtering, view columns, and sorting.  As such, this has the potential to be quite a bit more troublesome than what my colleague had run into, depending on how customized your client’s environment is.  Further testing showed that custom entities enabled for posting through Settings -> Post Configuration experience the same issue as well.  And since these views just look like any other view, their reluctance to being imported isn’t readily apparent. 

We’ve went ahead and logged a case on Connect for this, which you can view here.

CRM 2011 UR17 has been Released!

Posted by on May 9, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2011  |  commentsComments (0)

Microsoft just released UR17 for CRM 2011 and it comes packed with 60+ bug fixes.  The big news is that with UR17, Internet Explorer 11 on Windows 8.1 or Windows 7 is now supported in CRM 2011!

The following are some key bug fixes that stuck out for me:

  • After Update Rollup 12 or greater is applied to the Outlook client, the startup time for Outlook.exe can be significantly impacted if the configured organization contains many customizations
  • Recurring Series Expansion job does not complete if Recurring Appointment owner is a team.
  • N:N relationship records are not replicated offline
  • Cannot change owner on create of Appointment after Update Rollup 16
  • When you have an HTML web resource on a form, the web resource is removed when clicking the backspace button in Internet Explorer

And for devs, there was a fix to the OrganizationServiceContext as well

  • SDK OrganizationServiceContext fails to update a related record while in a create transaction.

Head to the following link for the full list of bug fixes - http://support.microsoft.com/kb/2915687/en-us.

And here for the actual download - http://www.microsoft.com/en-us/download/details.aspx?id=42672.

As always, the best practice is to backup your organization and be sure to install the UR in a development environment first to test all of your current functionality and make sure there are not any issues with it before installing to production.

CRM 2013 - Phone Call fields won’t default from Sub-Grid

Posted by on May 8, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2011,   |  Microsoft Dynamics CRM 2013  |  commentsComments (0)

We recently ran into the following issue with native defaulting of fields on the New Phone Call form from an Activities sub-grid in CRM 2013. The functionality exists in CRM 2011 and exists in CRM 2013 if you create a New Phone Call from a related Activities grid.

For example, you can go to a Contact record and view the related Activities through the Associated Grid as shown below.

image

Then if you click to add a new Phone Call, a new Phone Call record displays with the Call To and the Phone Number field automatically populated.

clip_image001

This is a great time saver and allows you to quickly create a Phone Call record. The issue is if you use a sub-grid for Activities (rather than needing to navigate to the related grid) then the Call To and Phone Number won’t auto-populate as it does from the related grid or how CRM 2011 used to default it.

For example, I have an Activities sub-grid on my Contact form which allows me to easily create a new Phone Call directly from the sub-grid.

image

This pops open a new Phone Call record but without Call To and Phone Number populated.

image

Microsoft was made aware and a Connect item has been created here. Any upvotes will help bring this functionality sooner rather than later!

Is your CRM 2013 Activities Tab disabled? It might be your fault!

Posted by on May 6, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2013  |  commentsComments (0)

Today’s guest blogger is Ian Moore, an Associate Developer at Sonoma Partners.

In CRM 2013 one of the new interface enhancements is the Activities Tab, which contains related Activities and Notes for the record you are currently viewing. You can also add new Phone Calls and Tasks and see them appear in the feed instantly. Seeing as this is out of the box functionality in CRM 2013, it might surprise you when a user says these activity forms are disabled and they can’t use them! When trying to add a new activity through this control, all the fields were locked. How could this happen?

clip_image002

As it turns out, some custom Javascript code on this entity form was having some unintended effects on the Activities Tab. Occasionally there are scenarios where a CRM form should be disabled and can’t be handled by security roles and read-only forms alone. In this particular case, the Account form needed to be disabled based on a combination of security role and an option set used to track the type of account.

To accomplish this, we used the controls collection available through the SDK to disable all controls individually:

// After validating our business logic...
Xrm.Page.ui.controls.forEach(function (control, index) {
    var controlType = control.getControlType();
    if (controlType != 'iframe' && controlType != 'webresource' && controlType != 'subgrid') {
        control.setDisabled(true);
    }
});
 

Once this executes, any control on the form that’s not an iframe or subgrid is going to get disabled and show the lovely grey lock icon. Could the Activity Pane fields really be a part of this collection? Using the same forEach method above and logging the names of each control to the Javascript console, you will see the following names in addition to all your regular attributes:

clip_image004

The type codes for Phone Call and Task in the control’s name are a dead give away to identify the controls we’re trying to avoid. Therefore a quick solution to our problem is to simply check that “quickCreateActivity” is not in the control’s name, like so:

Xrm.Page.ui.controls.forEach(function (control, index) {
    var controlType = control.getControlType();
    if (controlType != 'iframe' && controlType != 'webresource' && controlType != 'subgrid'
        && control.getName().indexOf('quickCreateActivity') == -1) {
        control.setDisabled(true);
    }
});
 

Now your entity form will still be disabled like you expect, but users will still be able to create Phonecalls and Tasks through the Social Pane/Activities Tab like they expect.

One additional thing to note is that while these activity “quick create” fields are in the Xrm.Page.ui.controls collection, this collection does not include the quick create forms that are opened from the command bar – which might be why this Activity Pane behavior was so unexpected in the first place!

Dynamics CRM - Managing Appointment Status Reasons

Posted by on May 1, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2011,   |  Microsoft Dynamics CRM 2013  |  commentsComments (1)

If you have ever tried adding, updating or deleting Status Reasons on the Appointment entity for any non-Open values, you’ll know that the Status selector is disabled as shown below.  This prevents Admins from being able to easily modify Status Reasons for Completed, Canceled and Scheduled states. 

image

Fortunately we can still insert, update or delete Status Reasons using the API.  To insert a new Status Reason value there is a special API method that is different from inserting a regular Option Set value.

Below is an example of using the InsertStatusValueRequest which allows you to specify which StateCode the new value will be associated to.  In this sample we are creating a new value, “My Canceled Value”, for the “Canceled” StateCode.

var insertStatusValueRequest =
        new InsertStatusValueRequest
        {
            AttributeLogicalName = "statuscode",
            EntityLogicalName = Appointment.EntityLogicalName,
            Label = new Label("My Canceled Value", 1033),
            StateCode = 2 // Canceled
        };

OrgService.Execute(insertStatusValueRequest);
 
 

To update the newly added Status Reason value, there isn’t a specific request for Status Reasons but we can use the same request for regular Option Sets.

var updateOptionValueRequest =
        new UpdateOptionValueRequest
        {
            AttributeLogicalName = "statuscode",
            EntityLogicalName = Appointment.EntityLogicalName,
            Value = 100000000,
            Label = new Label("Updated Option 1", 1033)
        }; 

OrgService.Execute(updateOptionValueRequest);
 
 

Same goes for deleting a Status Reason value.  We can use the same request for regular Option Sets as well.

var deleteOptionValueRequest = 
        new DeleteOptionValueRequest {
            AttributeLogicalName = "statuscode",
            EntityLogicalName = Appointment.EntityLogicalName,
            Value = 100000000
        };

OrgService.Execute(deleteOptionValueRequest);

 

Hopefully in the future Microsoft will enable the Status selector as there doesn’t seem to be an apparent reason for it to be disabled.  This will allow non-developer Admins to be able to easily manage Appointment Status Reasons without using code.

Simple Dynamics CRM Lookup using Kendo UI

Posted by on April 28, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2011,   |  Microsoft Dynamics CRM 2013  |  commentsComments (6)

Using third party libraries is a great way to speed up development and save some money by not having to reinvent the wheel. If you are a developer and haven’t checked out Telerik’s suite of controls, I definitely recommend it. They have a great set of javascript widgets and frameworks called Kendo UI which works very well with Dynamics CRM.  In this post I will show how easy it is to make your own custom CRM Lookup in just a few lines of code thanks to Telerik’s AutoComplete control.

First, we need the Kendo libraries. If you haven’t purchased the Kendo controls, you can download them for a trial here.  Then you can add the references to the header of your html page. This example will also require jQuery so be sure to include it as well.

<head>
    <title></title>
    <link href="kendo.common.min.css" rel="stylesheet" />
    <link href="kendo.default.min.css" rel="stylesheet" />
    
    <script src="jquery.js"></script>
    <script src="kendo.web.min.js"></script>
</head>
 

Next, add a simple input tag to the page and give it an ID. This will become the Lookup control.

<body>    
    <input id="accounts" />
</body>
 

Then add some script as well to execute a function on document ready. To keep it simple, this example uses an inline script tag.

<script>
    $(document).ready(function () {
    
    });
</script>
 
 

Now, inside the ‘ready’ callback, we can setup the Kendo AutoComplete control. First define the Schema Name of the entity you want the Lookup to point to and then define the Schema Name of the attribute that you would like to display in the Lookup dropdown.

var entityName = "Account";
var primaryAttribute = "Name";
 

 

Now you can create the Kendo AutoComplete control using the ID of the input element you added in the second step. The Kendo data source supports OData so we can easily set it up to hook up to CRM’s OData endpoint. Since OData is case sensitive, make sure your entityName and primaryAttribute are set correctly.

$('#accounts').kendoAutoComplete({
                dataSource: {
                    type: "odata",
                    serverFiltering: true,
                    transport: {
                        read: {
                            url: window.parent.Xrm.Page.context.getClientUrl() + 
                                 "/XRMServices/2011/OrganizationData.svc/" + entityName + "Set",
                            dataType: "json"
                        }
                    }
                },
                dataTextField: primaryAttribute,
                animation: {
                    open: {
                        duration: 0
                    },
                    close: {
                        duration: 0
                    }
                }
            });
 

If you attempt to test your page now with just the code so far, you will notice that it won’t quite work just yet.  Kendo by default will try to use some OData parameters that the CRM OData endpoint doesn’t support. Therefore we have to setup a parameterMap function on the transport object so we can remove some of the unsupported filters.

Below is the updated transport object with the new parameterMap function. This function will set ignoreCase to false on any filters passed in.  If ignoreCase is set to true then Kendo will use the ‘tolower’ OData filter which CRM doesn’t support.  Kendo will also use the unsupported $inlinecount and $format filters as well so we need to remove them from the list.

transport: {
    read: {
        url: window.parent.Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/" + entityName + "Set",
        dataType: "json"
    },
    parameterMap: function (options, operation) {
        if (options.filter && options.filter.filters) {
            for (var i = 0; i < options.filter.filters.length; i++) {
                // CRM odata doesn't support 'tolower'
                options.filter.filters[i].ignoreCase = false;                       
            }
        }

        // CRM odata doesn't support $inlinecount or $format
        var paramMap = kendo.data.transports.odata.parameterMap(options);
        delete paramMap.$inlinecount;
        delete paramMap.$format;

        return paramMap;
    }
}
 

Now your page is ready to go and you can upload all the necessary files (kendo.common.min.css, kendo.default.min.css, jquery.js, kendo.web.min.js and your html page) to a CRM solution. Then embed your html web resource to a form and you should see a text box like so:

image

As you start typing into the box, it will make a CRM OData call filtering by the characters you typed. By default, each character pressed will hit the OData endpoint but you can set ‘minLength’ on the AutoComplete control to limit the number of characters required before a search is performed. All the matches found will be displayed in a nice dropdown shown below.

image

There you have it, a simple custom Lookup control for CRM! A couple things that could be done to expand this control even more, would be to add custom styling to make it look more like the Lookup control in CRM as well as the ability to filter the records even more, by active records for example.

For the full source code, check out the code sample on MSDN here.

Dynamics CRM Plugins in F#

Posted by on April 24, 2014 in   |  Microsoft Dynamics CRM,   |  Microsoft Dynamics CRM 2011,   |  Microsoft Dynamics CRM 2013  |  commentsComments (0)

Today’s guest blogger is John Trujillo, a Developer at Sonoma Partners.

Every so often I promise myself I will spend more time learning the F# programming language. For one reason or another, I rarely do. Yet, whenever I think back to my favorite college programming courses, the courses in non-imperative languages (like Scheme or ML) always come to mind. So it should only make sense for me to learn F#, especially since it is fully supported in .NET. I recently decided to make good on my promise, this time attempting to apply what I have learned to a Microsoft Dynamics CRM plugin.

Even if you don’t know much about F# but are familiar with .NET and Dynamics CRM development, none of the following code snippets will be a complete mystery. However, you may want to spend some time getting to know the language. I won’t go into great detail regarding syntax. Thus far I have found it to be a fun language to code in, and I recommend you take a look for yourself. The F# community is very active and helpful. In my case I followed the “Why use F#?” series at F# for Fun and Profit, but you should also visit The F# Software Foundation. There is a huge selection of books available for purchase. Compilers are freely available on all major OSes. You can code on the browser at Try F#. Likewise, if you are reading this post, you may already be developing for CRM in Visual Studio, and so F# projects are already available to you. Visual Studio also provides a REPL interactive window to try out snippets as you develop your project. You can also create F# programs in LINQPad.

On to the business of creating a plugin. There are only a handful of steps to get started. The biggest hurdle for me was getting my project set up to play nicely with CRM and the Registration Tool, which I will point out shortly.

  • Add a new F# Library Project. This type of project is available in Visual Studio out of the box.clip_image002
  • Grab the latest Dynamics CRM 2013 SDK core assemblies from NuGet.
  • Delete the default .fs and .fsx files in the project and add a new F# file for your plugin. In my example, I named it AutoNamePlugin.fs. Here is what the initial plugin code looks like, which is the minimum necessary to validate registration and execution:
// AutoNamePlugin.fs
namespace Sandbox2013.Crm.Plugins.Functional

open Microsoft.Xrm.Sdk

type AutoNamePlugin(configuration) =
    interface IPlugin with
        member this.Execute serviceProvider = 
            raise (new InvalidPluginExecutionException("F# plugin registered"))
 
image 
 
  • Build the project, register the assembly, and add your plugin steps as you normally would in C#. This was the trickiest part to set up correctly. I ran into a few roadblocks preventing me from registering and testing the plugin. You will likely encounter the same issues, so here are my solutions:
    • Sign the assembly. The project properties UI doesn’t have a Signing tab, so you will have to create a key pair file manually.
      • Enter in the command prompt:

c:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\sn.exe -k <KeyName>.snk

      • Add the .snk to the project post-build event. (I copied a post-build script from a C# plugin project and just updated file/dll names appropriately.)
    • Don’t define the plugin type inside of a module. It’s not shown in the snippet above, but I originally defined the plugin (type AutoNamePlugin) within a module. The Plugin Registration tool would not register it, even though I could see and select it in the tree view in the Update Assembly dialog. I was able to add the assembly after I pulled it out of the module. Namespaces are fine.

image

    • Add FSharp.Core.dll to the merged assembly. Once my assembly was successfully updated and my first Opportunity create step added, I tried to get my exception to fire when I saved a new Opportunity. However, the popup error was “Unexpected Error” and not the business logic error message I set up in the plugin. When I removed the exception, the error still occurred. I jumped onto the CRM server to look at the event logs. It turns out I needed to merge in the Fsharp.Core assembly as well. Add that as part of the post-build event script, which will resolve the error.
  • Once you have verified that your plugin is correctly set up, replace the exception with your own logic.

image

image

And there you have it, now you can enjoy creating plugins in a functional language!

For the curious, I uploaded my first full plugin implementation, which you can get here.


Contact Us for a Quote, or Personalized Demonstrationof Salesforce.com or Microsoft Dynamics CRM for Your Business.

Contact Us