Thursday, October 28, 2010

Microsoft CRM 2011 New Feature –Remove Add Existing Button

I have repeatedly been asked by customers if I can remove the “Add Existing” button from associated views in CRM 4.0. There are times where it just does not make sense.  There was no supported way to do this, although there were various JavaScript solutions which were a little (lot) messy.

Now with Dynamics CRM 2011 we have a fully supported way to interact with and change most aspects of the ribbon, including removing the add existing button. For today’s article I’ll step through how to remove the “Add Existing” button from the Contacts Associated view. First we will create a new solution to house our changes and add the Contact entity to this solution.

Navigate to Settings, Solutions and create a new solution. Give your solution a name, add a publisher, version and click save. I’ve called mine “Remove Add Existing Button”.

image

Next add the contact entity to your solution. We do this by navigating to Components within the solution and clicking “Add Existing” and Entity. Select the Contact Entity.

image

We are now ready to export your solution and edit the customisation.xml file. Click “Export Solution” and follow the prompts (Don’t select any other items to export as you navigate the prompts and select unmanaged as your package type).

image

Navigate to where you saved your solution zip file and unzip the it. Your unzipped directory should look like this.

image

Open the customisations.xml file. I would suggest using Visual Studio or an xml editor to edit this file. Search for the following section in the customisations.xml  file:

<RibbonDiffXml>
      <CustomActions />
       <Templates>
         <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
       </Templates>
       <CommandDefinitions />
       <RuleDefinitions>
         <TabDisplayRules />
         <DisplayRules />
         <EnableRules />
       </RuleDefinitions>
       <LocLabels />
     </RibbonDiffXml>

We are going to replace the <CustomActions /> element with the following:

<CustomActions>
          <HideCustomAction Location="Mscrm.SubGrid.contact.AddExistingStandard"
         HideActionId="Sample.Mscrm.SubGrid.contact.AddExistingStandard.HideAction" />
        </CustomActions>

Once we’ve done that, save and close your customisations.xml and add it back to your solution zip file, overwriting the existing customisations.xml file.  

We can now re-import our solution file. Navigate back to CRM and Settings, Solutions and click “Import”

image

Step through the prompts and your solution will be re-imported. Once your import is successful, click “Publish  All Customisations”

image

If you navigate to Accounts, select an account and then navigate to the associated contacts, you will see that the “Add Existing” button has been removed. Below you can see the “Add Existing” button in the Associated Contact view before we removed it.

image

and after we removed it.

image

You can use this concept for any entity. Repeat the above steps for the entity /entities you wish to remove the “Add Existing” button for and in the customisations.xml file for each entity replace “contact” with the name name of you entity under that entities <RibbonDiffXml> element as per the below.

<CustomActions>
          <HideCustomAction Location="Mscrm.SubGrid.<entity name here>.AddExistingStandard"
         HideActionId="Sample.Mscrm.SubGrid.<entity name here>.AddExistingStandard.HideAction" />
        </CustomActions

For your reference I have attached the solution file I created for this example here: RemoveAddExistingButton_1_0_0_0.zip

  I love the solution concept in 2011! Be warned this is an unmanaged solution and hence you cannot roll it back. Put it in a test or dev environment first!

Wednesday, October 27, 2010

Microsoft CRM 2011 New Features–Dynamic Marketing Lists

Over the course of the next few weeks I would like to review some of the new features of Microsoft CRM 2011. But rather than going through some of the major changes, such as the new ribbon interface, solutions etc, I’m going to focus on the smaller less advertised new features. Each of these will be very short basic overviews to demonstrate the breadth of new features in the product. This way I hope to get at least a few of these up every week. Interspersed with the short articles I also hope to have some more in depth articles on some business uses for these new features.

Today’s feature is simple but I can see lots of uses for it. You now have the ability to create Dynamic Marketing Lists.

image

When you set the Type to Dynamic, you only have the ability to use q query to define your Member list. This means that any record that meets the filter criteria will automatically be added to the marketing list.

image

The one downside to be aware of is that Dynamic Marketing Lists do not appear in the Marketing List Associated View of Account / Contact or Lead and are not returned in Advanced Find queries.

Tuesday, July 28, 2009

Microsoft CRM Multi Select Picklists, Many to Many Relationships and Advanced Find

I love using the many to many (n:n) relationship in Microsoft CRM 4.0. I most often use it to create a solution for a multi select picklist requirement. For example I may have a requirement to track which industries an account belongs to. The problem is an account can be linked to more than one industry – I need a multi select picklist. Now there are a multitude of solutions out there for multi select picklists, most are really elegant when it comes to the UI and usability but pose all sorts of problems when it comes to searching using Advanced Find. That’s where the n:n relationships can provide a great solution.

Continuing our example above I have created a new entity called industry and linked it to the account entity using an n:n relationship. The result is Industry now appears as a new menu item appears on the left hand navigation bar in the Account screen.

image

Many users however would rather have the Industry listing  on the form itself rather than as a menu item. To solve this I place the n:n related entity in an IFrame on the form using the great solution CRM 4.0 Many 2 Many IFrame Viewer by Adi Katz. The best thing about Adi’s solution is that the IFrame is automatically refreshed after updating your selections.

image

To make the solution a little cleaner I would like to remove the Industries menu item on the left hand navigation bar. Now you can achieve this by setting the Display Option in the n:n relationship settings to Do Not Display as shown below.

image

However this will remove the relationship in the Advanced Find and I can no longer search industries as a Related Entity to Accounts in the Advanced Find screen. Strangely enough this is only a problem with an n:n relationship.

image Industries will only appear as a Related entity in Advanced Find if the display option is set to “Use Plural Name” or “ Use Custom Label” If you use the latter the entity name will be what ever you used as your Custom Label.

To solve this problem rather than removing the menu item from the left hand nav bar by setting the Display Option to Do Not Display, you can remove it by using some simple JavaScript in the form onload event.

function ShowHideLeftNav(strNavItemID, blnVisible)
{
    try
    {
    var NavItem = document.all["crmNavBar"].all[vstrNavItemID];
    NavItem.style.display = (blnVisible == true) ? "inline" : "none";
    }
    catch (e)
    {
    }
}

ShowHideLeftNav('navnew_new_industry_account', false);

Typically the strNavItemID parameter is the name of the n:n relationship prefixed with nav. So in our example it is 'navnew_new_industry_account'. You can also use the IE developer toolbar (now built in to IE 8) to retrieve this.

Now you have a great solution for a multi select picklist on the form, have not confused users with multiple locations to update the list and have maintained the Advanced Find functionality :)

Monday, February 16, 2009

Creating a Sub Lookup in Microsoft CRM 4.0

Quite often there is a requirement to have the values of one picklist or lookup be determined by the value of another picklist or lookup. As most of you will know Microsoft CRM does not have the concept of sub picklists or sub lookups. I’ve often seen this requirement solved through the use of picklists and JavaScript. Yuk! This solution means that every time a new value is added to either the parent or child picklist, the JavaScript code needs to be changed. Not a great solution for system administrators who have no knowledge of JavaScript.

Here is a simple solution using lookups rather than picklists with some simple, generic (and warning: unsupported) JavaScript.

For my example today lets presume I need to add a Primary Industry lookup to the Account form. I also need add a Sub Industry lookup where the values shown are determined by what I select as the Primary Industry. 

First I need to create two new entities, Primary Industry and Sub Industry. Next I need to create a 1:n relationship between the two new entities with Primary Industry as the Primary Entity. As you can see in the image below I have also set Primary Industry relationship attribute as Business Required so all Sub Industries must have a Primary Industry.

image

Next I add the Primary Industry attribute to the Sub Industry form.

image

In order to be able to filter the Sub Industry lookup based on the selected Primary Industry value I need to add the Primary Industry attribute as a find column in the Sub Industry Lookup View. I can now publish my two new entities.

image

I add some values to my Primary Industries and my Sub Industries.

image

Now I need to add the Primary and Sub Industry lookups to my Account form. I create  a n:1 relationship between the Account entity and my Primary Industry and Sub Industry entities. In each case the Account Entity will be the Primary Entity. I can then add the created Primary Industry and Sub Industry lookup attributes to the Account form as shown below.

image

Now I need to add the JavaScript to filter the value of the Sub Industry lookup based on what is selected as the Primary Industry. On the change event of the Primary Industry lookup I add the following JavaScript:

var lookupItem = new Array;

lookupItem = crmForm.all.new_primaryindustryid.DataValue;
var searchVal = lookupItem[0].name;
crmForm.all.new_subindustryid.additionalparams = ‘search=' + searchVal;

I can now publish all my changes and test the result. As you can see below because I selected Finance as the value for my Primary Industry, when I click on the lookup for the Sub Industry it is “pre-filtered” and only shows the Sub Industries that relate to Finance.

image

Wednesday, February 11, 2009

New Tool for for Comparing Customization

The one thing I promised myself when I started this blog is that I wouldn’t use it to simply re-blog about recently released service packs, tools etc. but … this release is just to exciting not to blog about so I’m going to break my rule just this once!

Microsoft in collaboration with  Sonoma Partners have just released a tool to compare customisation files! http://msdn.microsoft.com/en-us/library/dd442453.aspx

This from the Sonoma Blog (Permalink):

Customization Comparison Utility
The Customization Comparison Utility allows you to take two exported customization files (either xml or zip) and display all the differences between the files. You can review any two valid customization files and also export the results to Excel for additional analysis or documentation needs. Similar to many source control systems, the tool displays to you the following:

  • What is identical between the systems
  • What has changed between the systems
  • Exists in the source system, but not the target
  • Exists in the target system, but not the source "

This is going to be a very very useful tool, especially on larger more custom intensive projects :) Now if we can just have a tool that allows us to consolidate configuration from multiple config files, that would be great :)

Tuesday, February 10, 2009

Changing the schedule for the Deletion Service

I came across this tool the other day when I was asked by a client if it was possible to force the deletion service to run. When you delete a record in Microsoft CRM, most often the record is not deleted from the database but rather the deletionstatecode is set to 2 (This is not always the case so be careful in using this for reporting etc). When the deletion service runs it will remove the record from the database. After some investigation it looks like the deletion service runs every 24 hours. This means that when writing reports you need to make sure you exclude deleted records as it is likely there will be records with a deletionstatecode  of 2 in the database.

Currently the only way I know to force the deletion service to run on Microsoft CRM 4.0 is to stop and restart the Asynchronous Service. I have since found this tool that allows you to change the schedule and frequency of when the deletion service runs: http://code.msdn.microsoft.com/ScaleGroupJobEditor. This is useful when you need to ensure deleted records are quickly removed from the database :)

Friday, February 6, 2009

What is xRM?

First it was CRM (Customer Relationship Management), then came PRM (Partner Relationship Management), ERM (Employee Relationship Management) and a host of other ?RM solutions. The problem was in most cases there were specific applications that met each type of requirement. While managing relationships was at the heart of each strategy, the nuances around each was such that no one application was flexible enough to meet all the functionality requirements. Microsoft Dynamics CRM seems to have finally met this challenge and quite often you will hear Microsoft refer to Microsoft CRM as a xRM platform.

So what exactly is meant by xRM and how is Microsoft CRM an xRM platform? The “x” in xRM is a placeholder for anything, so essentially xRM means the management of any type of relationship. This might be for example, the management of a company’s relationship with its employees. Now it can be argued  that an HR system fills this function, but most often the HR system misses the subtleties of managing a relationship and more importantly it lacks  the flexibility to be configured to meet the company’s ever changing strategies around this relationship. Microsoft CRM however has the core functionality to track manage the relationship aspect and the flexibility to be configured to meet changing  Employee Relationship Strategies. Now I can feel the wrath of the HR Managers bearing down on me as they say “Karl are you honestly saying Microsoft CRM is an HR solution?” No absolutely not! What I am proposing is that Microsoft CRM together and integrated with (whether the integration is technical or strategic) an HR system can be used as a very effective Employee Relationship Management solution.

Before I annoy any more HR managers let me give another real world example of how I’ve seen Microsoft CRM used as an xRM platform. In this case it was a Private School. Their Student Management system very effectively allowed them to meet the day to day requirements of managing students. It managed timetables, financials, etc well but it couldn’t identify and track the inter relationships between the students. So for example I couldn’t easily tell that Jimmy’s brother was also at the school, nor that their father was a past alumni and Jimmy’s mum was a bit of a worry wart and emailed / called the school often. By integrating their existing Student Management System with Microsoft CRM, the school was able to effectively manage all aspects of their relationships with their students. Effectively a “S”RM solution :)

In both the above examples Microsoft CRM was configured to meet very different requirements. There was no mention of Accounts, Contacts and the term customer was completely removed. Sometime I do wish that Microsoft CRM was not called Microsoft CRM and rather it was renamed to be what it really is: The Microsoft RM platform. And how cool would it be if it was renamed the Microsoft Office RM platform :) One can always dream!