Monday, November 14, 2011

The Flying W by Glenn Wilson

My Wife Anne Marie and I had a great vacation in Philly this weekend with my Mom.  We stopped by Weidener University on Saturday and took some panoramic photos of a sculpture that my Grandfather, Glenn Wilson, designed for the school called The Flying W.

Thursday, September 1, 2011

Xrm.Page.ui Not Available on Primary Grid


While developing an EnableRule for some new functionality I decided to use an Async call.  Here is a great link on how to use Async calls with EnableRule.

Microsoft even notes this strategy in the SDK documentation: 

Consider that Microsoft sees this as the “proper way” to do things you might think that they would provide the necessary methods to complete this, that would only be half correct.

All of this works if you are on an entity form because Xrm.Page.ui.refreshRibbon() is available.  Unfortunately if you are in a grid such as the one displayed below, Xrm.Page.ui is null, which means you cannot call the refreshRibbon() method.



If anyone knows a way in which to get around this please leave a comment Smile

Wednesday, August 17, 2011 Returns Null in PreCreate

In CRM 4.0 using the Target.GetPickListProperty("fieldname").name property would return the string value of the pick list item display name even in a PreCreate plugin step.  Apparently though in 2011 the name property just returns null until after the initial create has been done.  Instead of using name make sure to use the Value property which is always available.

mypicklist Example:
Value  Name
1         Approve
2         Cancel

PreCreate step:
Target.GetPickListProperty("mypicklist").name  // this would return null
Target.GetPickListProperty("mypicklist").Value // this would return either 1 or 2

PostCreate step:

Target.GetPickListProperty("mypicklist").name  // this would return either "Approve" or "Cancel"
Target.GetPickListProperty("mypicklist").Value // this would return either 1 or 2

Tuesday, June 28, 2011

Plugin Set to Use Offline but Entity Offline Settings Not Configured

While attempting to deploy a solution to CRM 2011 I received the following error during the import.


0x80040203 - Supported deployment does not agree with message availability

After reviewing the code for the plugin I realized that it was attempting to register the plugin for both Server and Offline.


The problem there was that the Entity was not set for Offline mode.


One the entity was updated the solution installed correctly.

Wednesday, June 8, 2011

CustomRule - Just one at a time please.

When you define a CommandDefinition in the CRM 2011 and you want to use a CustomRule underneath an EnableRule just remember that your CustomRule will never fire if you have other EnableRules applied to that Command Definition.  This means that you can't use a bunch of the already build in EnableRules on top of your CustomRule.... which sucks.  Instead you need to re-create the functionality in your CustomRule javascript.

For example you can't just use the Mscrm.SelectionCountExactlyOne rule to determine if there is only one record selected in a grid.  Instead you have to do the following; Pass in the CrmParameter called SelectedControlSelectedItemCount and then check to make sure that parameter equals one in your JS code.

I really don't like the ribbon schema.  It's confusing and the rules that apply to buttons you create don't always seem to apply to the ones that come out of the box, which makes it extremely hard to troubleshoot sometimes just using the output from the ribbonXmlExporter included in the SDK.

Here is an example of someone who has an example of what I described.

Thursday, June 2, 2011

Web.Config Modification Manager Update

So this is an update of a solution from Harmjan Greving which was an update from which can be used to view, modify, and create web.config modification that will be pushed to all servers within the farm.

The only changes I made from Harmjan's version was to fix some problems when loading modification which contained double quotes.  They were causing the page to load improperly.  Also for the current modification table I added a number field as the first column so that when I'm talking to customers over the phone they can tell me the number of mods or easily reference individual items.

To use it just download the webconfig.aspx page. Then drop it in the 12 hive at, C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN.

The page can be accessed through, http://CA:PORT/_admin/webconfig.aspx

Tuesday, May 31, 2011

SharePoint 2010, Event ID 7043: Could not load type 'Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker'

PROBLEM: Every time the application pool is reset the following error appears in the application log.

Load control template file /_controltemplates/TaxonomyPicker.ascx failed: Could not load type
'Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker' from assembly
'Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

ORIGINAL SOLUTION:   It appeared at first that the problem was with a HTML encoded ',' in the assembly reference of the file which I changed by editing the TaxonomyPicker.ascx file.

You can see here that the ',' character has been encoded into

Below you can see the correct way in which the reference should be done.

UPDATED SOLUTION:  The above updates stopped working and the next time an IISRESET happened the error came back.  After doing some research it appears that the TaxonomyPicker is never actually used.  To finally remove the error I just renamed the file to TaxonomyPicker_broken.ascx and the errors went away.

Wednesday, May 25, 2011

User Rights Issues in CRM using JavaScript

I needed to find a way to determine if a user did not exist in CRM or did not have any rights. The devError page is available in both CRM 4 and 2011 and returns the same errors. Also for this to work correctly the user must be in the same domain as CRM and the CRM site url must be in trusted or local intranet sites and passing the authentication automatically.

                                            url: data.serverurl + '/_common/error/devError.aspx',
                                            success: function (data) {
                                                if ($('div pre:contains("[CrmException: No Microsoft Dynamics CRM user exists with the specified domain name and user ID")', data).length > 0)
                                                { accessError = true; }
                                                else if ($('div pre:contains("[CrmException: The user is not assigned any privileges.")', data).length > 0)
                                                { accessError = true; }
                                            async: false

Wednesday, May 18, 2011

Passing Parameters Between Web Part and User Control

When creating a web part which encapsulates a custom user control the following is one way to utilize the custom attributes for the web part within the user control.

First find the class name of the user control in the code behind of the user control page.

User Control Code Behind - Class Name
Define a web part property in your web part code.  In this case I want users to enter a URL which I will use to load an iframe within the control.

Web Part Code - Property Definition
Next when creating your user control in the web part code make sure to specify the type of the control you are going to add as the class of your user control.  Then you can add attributes to the control which will be accessible when the user control loads.

Web Part Code - CreateChildControls()
Finally you can access the attributes you have added to the control from the code behind on the user control.  In the example below I am retrieving the ViewURL in the user control Page_Load so that I can update an iframe src with the URL I passed.

User Control Code Behind - Page_Load

Monday, April 25, 2011

System.ServiceModel.EndpointNotFoundException in OWSTIMER.EXE

I started getting this error every five minutes after the timer service would kick off.

An Unhandled exception ('System.ServiceModel.EndpointNotFoundException') occurred in OWSTIMER.EXE

Turns out that the error was due to the Forefront Identity Manager Service not being started.  After starting the service the error goes away.

Tuesday, April 19, 2011

CRM 2011 Publisher Policy / Redirection

While working on a CRM 2011 application I kept getting the following error even though I was not even using the CRM 4.0 SDK file.

Exception information: 
    Exception type: FileLoadException 
    Exception message: Could not load file or assembly 'Microsoft.Crm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

To get around the problem I put the following redirection binding to the CRM 2011 SDK in the web.config. This runtime info can go anywhere directly underneath the configuration node.

     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <assemblyIdentity name="Microsoft.Crm.Sdk"
                           publicKeyToken="31bf3856ad364e35" />
         <bindingRedirect oldVersion=""
                          newVersion="" />

Monday, April 18, 2011

Clear IE Cache Through Command Line

Apparently you can clear the IE cache using the command line.  This is going into batch files to reduce the number of times I have to click in IE.
  • All, RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 
  • History, RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1
  • Cookies, RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2
  • Temp Internet Files, RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
  • Form Data, RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16
  • Passwords, RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

Come Out and See Anne Marie in [title of show]

My lovely wife Anne Marie will be performing in [title of show] at The Little Theatre of Alexandria from April 23-May 14.  If you can make it out to support her I would appreciate it.  I'm planning on attending Easter Sunday, hope to see you there.

[title of show]

Directed by Michael Kharfen
Music and lyrics by Jeff Bowen
Book by Hunter Bell
April 23–May 14, 2011

[title of show] is a unique and quirky musical about two guys who write a Broadway musical about two guys writing a Broadway musical. With a couple of their actress friends, they journey from the unemployment line to the bright lights of Broadway. Don’t miss the show that The New York Times called “...genial, unpretentious and far funnier than many of the more expansively manufactured musicals that make it to Broadway.” This is a 21st century update of “putting on a show” clever songs and witty dialogue. (Strong Language)

Friday, April 15, 2011

CRM 2011 Ribbon XML Tips

  • SharePoint 2010 uses the same ribbon xml schema and there are a lot of resources which are also applicable to CRM 2011. So if a google search using 'CRM 2011 Ribbon' doesn't work try 'SharePoint 2010 Ribbon'.
  • In order to determine sequence numbers you first need to determine the sequence of items currently on the form. You can do this using a tool in the SDK which will allow you do download the ribbon definitions for all of the entities. C:\CRM SDK RC\samplecode\cs\client\ribbon\exportribbonxml\ 
  • NOTE:If you have Many to Many relationships within your custom entities make sure to update the SDK ExportRibbonXML utility to look enture the IsIntersect property is false or the export will fail.
    //Check for custom entities
    RetrieveAllEntitiesRequest raer = new RetrieveAllEntitiesRequest()
    {EntityFilters = EntityFilters.Entity};
    RetrieveAllEntitiesResponse resp = (RetrieveAllEntitiesResponse)_serviceProxy.Execute(raer);
    foreach (EntityMetadata em in resp.EntityMetadata)
      if (em.IsCustomEntity == true)
      entRibReq.EntityName = em.LogicalName;
        if (em.IsIntersect == true) //check to see if the entity is a M2M relationship table
          Console.WriteLine("M2M Entity, " + entRibReq.EntityName + ", will not be exported.");
          RetrieveEntityRibbonResponse entRibResp = (RetrieveEntityRibbonResponse)_serviceProxy.Execute(entRibReq);
          System.String entityRibbonPath = Path.GetFullPath(@"..\..\..\ExportRibbonXml\ExportedRibbonXml\" + 
            em.LogicalName + "Ribbon.xml");
          File.WriteAllBytes(entityRibbonPath, unzipRibbon(entRibResp.CompressedEntityXml));
          //Write the path where the file has been saved.
  • When creating a group only the MaxSize element is required under Scaling unless you want the button to change size based upon the size of the screen.
  • Sequences are extremely important, for example in the following section you will see that a MaxSize has come after a Scale element. This will break the ribbon XML so make sure to look back at the exported ribbon XML from the tool in the SDK to make sure you have all the sequence number correct.
  • Although MaxSize and Scale elements both go underneath the Scaling element you cannot add more than one element at a time under the Scaling element.
  • Example:
    <CustomAction Id="Mscrm.Form.MainTab.Help.Scaling" 
    <Scaling Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Scaling"> 
    <MaxSize Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.MaxSize" Sequence="200" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Large" /> 
    <Scale Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Scale.Medium" Sequence="300" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Medium" /> 
    <Scale Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Scale.Small" Sequence="310" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Small" /> 
    <Scale Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Scale.Popup" Sequence="320" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Popup" /> 
    If you try to import this customization you will get an error in the trace log such as "Crm Exception: Message: The import file is invalid. XSD validation failed with the following error: 'The element 'CommandUIDefinition' has invalid child element 'Scale'.'." Instead what you need to do is break this out into 4 separate Custom Actions
    <CustomAction Id="Mscrm.Form.MainTab.Help.MaxSize" Location="Mscrm.Form.{!EntityLogicalName}.MainTab.Scaling._children" Sequence="500"> 
    <MaxSize Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.MaxSize" Sequence="71" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Large" /> 
    <CustomAction Id="Mscrm.Form.MainTab.Help.Scaling.Medium" Location="Mscrm.Form.{!EntityLogicalName}.MainTab.Scaling._children" Sequence="501"> 
    <MaxSize Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Medium" Sequence="72" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Medium" /> 
    <CustomAction Id="Mscrm.Form.MainTab.Help.Scaling.Small" Location="Mscrm.Form.{!EntityLogicalName}.MainTab.Scaling._children" Sequence="502"> 
    <MaxSize Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Small" Sequence="73" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Small" /> 
    <CustomAction Id="Mscrm.Form.MainTab.Help.Scaling.Popup" Location="Mscrm.Form.{!EntityLogicalName}.MainTab.Scaling._children" Sequence="503"> 
    <MaxSize Id="Mscrm.Form.{!EntityLogicalName}.MainTab.Help.Popup" Sequence="74" GroupId="Mscrm.Form.{!EntityLogicalName}.MainTab.Help" Size="Popup" /> 
  • RuleDefinitions must have the following elements/attributes. Even if there are no rules defined or you are not even adding a Tab they all must be there.

Global Context for CRM 2011

When creating htm pages as webresources in 2011 there are many times you would want to get information about CRM such as the orgname and server url.  This is where the ClientGlobalContext comes in to play.

 <script src="ClientGlobalContext.js.aspx"></script>  

Remember that if the web resource name has a folder name(s) before it you must include preceding "../" in front of the script name.

Example 1:
Webresource Name: mycust_/test.htm
Script reference:
 <script src="../ClientGlobalContext.js.aspx"></script>  

Example 2:

Webresource Name: mycust_/elements/test.htm
Script reference:
 <script src="../../ClientGlobalContext.js.aspx"></script>  

By adding this reference into your htm file you will now have access to several javascript functions:

getAuthenticationHeader: Returns the encoded SOAP header that you need to use Microsoft Dynamics CRM 4.0 Web service calls using Jscript. 

getOrgLcid: Returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the base language for the organization.

getOrgUniqueName: Returns the unique text value of the organization’s name.

getQueryStringParameters: Returns an array of key value pairs representing the query string arguments that were passed to the page.

getServerUrl: Returns the base server URL. When a user is working offline with Microsoft Dynamics CRM for Microsoft Office Outlook, the URL is to the local Microsoft Dynamics CRM Web services.

getUserId: Returns the GUID value of the for the current user.

getUserLcid: Returns the LCID value that represents the Microsoft Dynamics CRM Language Pack that is the user selected as their preferred language.

getUserRoles: Returns an array of strings that represent the GUID values of each security role that the user is associated with.

Additionally this allows for access to some CRM Global Variables:

var USER_GUID='\x7b2CBE7DEF-1141-E011-89F6-A956C6342E5F\x7d';
var ORG_UNIQUE_NAME='test';
var SERVER_URL='https\x3a\x2f\\x2ftest';
var USER_ROLES=['a5201165-7ebd-47dc-af91-3185fc89b077'];
var CRM2007_WEBSERVICE_NS='http\x3a\x2f\\x2fcrm\x2f2007\x2fWebServices';
var CRM2007_CORETYPES_NS='http\x3a\x2f\\x2fcrm\x2f2007\x2fCoreTypes';
var CURRENT_THEME_TYPE='Outlook14Silver';
var CURRENT_WEB_THEME='Default';
var IS_OUTLOOK_14_CLIENT=false;
var IS_ONLINE=true;

Sunday, February 20, 2011

iPhone Jailbreak Software

Backup SHSH Blobs

Check if your device is unlockable or Tethered with just a simple USB connect
Put your device into a jailbreakable state.
sn0wbreeze 2.2
A Custom IPSW Creator.

Friday, February 18, 2011

Hibernation Mode With Windows Server 2008 and Hyper-V

On occasion I need to run Hyper-V for testing on my laptop.  Most of the time though I would love to have the power management function such as hibernation which is disabled by Hyper-V.  In order to get around this I have updated the following registry key which disables Hyper-V on startup.


Now when I want to run Hyper-V I just click on a .bat file on my desktop which contains the following commands. 

net start hvboot 
net start vmms
net start nvspwmi
net start vhdsvc

Now that you have enabled Hyper-V the power management features will no longer be available until you reboot the system.  This isn't exactly a fix but it's a great workaround.

Thursday, January 6, 2011

RunAs Another User from Context Menu

If you would like a quick way to run programs as another user there is a utility from Sysinternals called Shell RunAs.  This utility will allow you to access the RunAs command from a context menu.