Wednesday, December 21, 2011

CRM2011 Entity Form Navigation items -- Sending Params

Recently a colleague needed to add a navigational item on the left nav of an entity form. No big deal right? CRM2011 has made this a relatively trivial "configure-it-through-the-ui" capability. But this requirement had a hang up. We were trying to pass form-level parameters to the target url similar to what one can do with IFRAME integrations in CRM. This could be accomplished in prior releases of CRM (3/4) by exporting ISV.config doing some modest editing and then importing the customization. 

Why not use an IFRAME?
Good question. File this one under constraints. We have similar capability on the left nav already that we carried over from CRM 4. We really wanted to locate the features near each other -- and the entity form we're working with was already pretty tall.

I found a handful of links that suggested using a form.onload script and modifying the link via the DOM. Or modifying the onclick behavior. These might work too -- but something that I observed while doing ribbon development gave me some hope. Here is a summary what I did and what I found.

*** Disclaimer: You just found this on some random blog. Be smart. Backup, create a new test CRM Org. Test it outside of Production. No warranties, expressed or implied.***


  • Create a "seed" navItem through the traditional, supported way. (Customize form, navigation..)
  • Create an Unmanaged solution
  • Include the entity in question
  • Export the Solution
  • Unzip the Solution Package
  • Open the customizations.xml file in a text editor
  • Search for "FormXML"
  • once found, search for the name of your link (by display name is fine)
  • You'll see something that resembles the following:



  • The "PassParams" attribute is what I added.
  • Zip up the assets that made up the original exported solution -- especially the modified customizations.xml
  • Import this package into CRM2011 through the traditional Settings>>Solutions feature


Publish after successful import.  That's it.  Verify using Fiddler.  Good luck.

Tuesday, January 11, 2011

CRM: Making fields required without being "required"

I ran into a set of requirements recently that called for a CRM field to be required for data entry, but not expressly required for workflow. Here's a Javascript quickie that sets the field requirement level -- just drop in the associated entities Form.Onload ScriptBlock. Not sure what makes something business recommended (the blue askerisk)... but this is a good start

crmForm.SetFieldReqLevel("statecode", 1);

1 = Required
0 = Not Required
2? = Recommended