Tag Archive for CRM 4.0

CRM Tool of the Week – POA Table Secret Decoder Ring

There are a couple tables in CRM that can be a real beast to work with. One of these tables is the PrincipalObjectAccess table, also know as the POA table. The POA table can be a pain to work with for 3 reasons:

  1. It’s Big
  2. It’s used by almost every query
  3. The Rights Mask values are hard to understand

There’s not much that can be done about the first two. But, thanks to CRM MVP Scott Sewell you can now easily encode and decode the Rights Mask values using his secret decoder ring.

What’s the problem with the Rights Access Mask?

The way CRM encodes the POA is no big secret. Each of the secrity permission like, read and write, has a value assocaited with it and they are all added together to calculate the rights mask value. At first it may seem like this would be a simple thing to enturpet, after all there are only a hand full of 9. But if you remember coin flipping excercises in math class this quickly adds up to 512 different possible values for the Rights Mask.

What does the Secret Decoder Ring do?

The POA Table Secret Decoder Ring is a simple to use Excel spreadsheet that Enodes and Decodes a Rights Mask Value letting. You can either set the security values in the left-hand column to get the Encoded Rights Mask value for that group of permissions or you can enter the Rights Mask value in the top of the right-hand column to see what set of permissions are for that value.



You can Download the POA Table Secret Decoder Ring from http://db.tt/ORT57Q6s


More Information

For more information check Scott Sewell’s article on Customer Effective Blog

Creating a Dynamic IFrame

Have you ever wanted to add a webpage into one of your CRM forms?

Well here is how you can add a dynamic IFrame to your CRM Forms.

In the example below we will add an IFrame on the Account Form that will show the Bing search results for the Account. This same technic can be used to add IFrame to other sites, like a LinkedIn Search on the Contact Form.

Adding an IFrame to your Form

First things first, we will need to add a plain IFrame to our form. This can be done through the form editor by following the steps below.

  1. Open the Main Account Form in the Form Editor, select the Insert Tab and click on the IFRAME button.
  2.  Give your Form a name and set a static URL for the page to initially load. Then click Ok to add the IFrame to the form.
  3. Save and Publish the Form.

If you setup the IFrame above you should now see a the Bing Search website embedded in your form.

Adjusting the size of the IFrame

The default size of the IFrame is set to 6 Rows. While this keeps your screen real-estate open for other things like attribute fields, it may seem to small in many cases. You can increase the size of the IFrame by double-clicking the IFrame to go into its properties and selecting the Formatting Tab.

Make the IFrame Dynamic

Embedding a website into your CRM Form has limited uses without having it automatically pass some information from the form to the webpage like passing the IFrame a field value or id. Just showing the Bing website is not going to be very helpful. However, having it automatically show the results for the account can add value.

To do this we will need to add a Form Script that will get the Account Name and update the URL of the IFrame.

Adding a Web Resource

  1. In the Form Editor click on Form Properties from the Home Tab.
  2. Under Form Libraries Click on Add.
  3. Press New.
  4. Give the Web Resource a name and Display Name. Then select Type “JScript”.
  5. Click on the Text Editor and Enter the text below.
    function updateBingIFrame()
    //get the name
    var accountName = Xrm.Page.getAttribute("name").getValue();
    //Check that there is a name
    if (accountName)
    //Update the IFrame
    var bingIframe = Xrm.Page.getControl("IFRAME_Bing");
    var newUrl = "http://www.bing.com/?q=" + encodeURIComponent(accountName);
  6. Click Ok, Save and Close, then Ok.

Adding the Event Handlers

The Event Handlers are what determines when an action is triggered. There are three places you can have your Form Scripts triggered; OnLoad of the form, OnSave of the from, or OnChange of a field. First we will add an OnLoad Event Handler to update the IFrame when it loads. Then we will add an OnChange Event Handler so the IFrame will refresh if the name field is updated.

  1. Scroll to the bottom of the Form Properties window and Click on Add under Event Handlers. The Control should initially be set to Form and Event OnLoad.
  2. Select the Library you created in the steps above and enter the function name updateBingIFrame . Please note you do not need to add () at the end of the function, this will cause an error if you do.
  3. Click Ok.

Next, add the OnChange Event.

  1.  At the bottom of the Form Properties window set the Control to Account Name. Then click the Add button.
  2. Select the Library you created in the steps above and enter the function name updateBingIFrame . Please note you do not need to add () at the end of the function, this will cause an error if you do.
  3. Click Ok.

Save and Publish your form and you should now have a dynamic IFrame. If you open an account record you should see the IFrame loaded with the Bing results for that account. If you change the account name you should see it automatically refresh the results.

URL Encoding

Don’t forget to Encode your URLs. If not you may run into errors like the one below or you may notice that the string you are sending gets abruptly cut off.

The path of the item ‘/….’ is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash. (rsInvalidItemPath)

This is because particular error occurs when try to open a report and pass an & in one of your query string parameters. Since & is used to separate out each of the parameters your browser gets very confused if you include it in a parameter value without encoding it.

In our Example, if you had account name was AT&T you would see the search results for AT in the IFrame if your form script does not encode the account name.

You can easily encode the url using the built-in JavaScript functions encodeURIComponent() or encodeURI().

var NewURL = 'http://www.bing.com/search?q=' + encodeURIComponent(Xrm.Page.data.getAttribute("customernumber").getValue());

Warning: Not all sites will play well with IFrames

Have you ever noticed that all of the examples like the one above use Bing Live Search and not Google. That’s not just because CRM is a Microsoft product. If you attempt to setup a similar search IFrame using google you will discover that google does not allow you place their site within an IFrame. Be aware they are not the only ones.



CRM Tool of the Week – SiteMap Editor

Microsoft’s SiteMap Editor

There are a number of SiteMap Editors available for customizing the CRM SiteMap without having to go in and manually edit the XML. Even though you will not a tool built directly into CRM for editing the SiteMap their is a one built by Microsoft Dynamics Labs and not a third party solution.

Similar to the CRM Ribbon Workbench that I covered a couple weeks ago, the Microsoft SiteMap Editor is installed as a Solution and when you open up the solution you are presented with a WSIYWIG style editor that graphically lets you update the sitemap. No XML hacking required!



Download the Microsoft SiteMap Editor

You can download the Microsoft SiteMap Editor from PinPoint at: http://pinpoint.microsoft.com/en-us/applications/microsoft-dynamics-crm-sitemap-editor-12884928049

Other SiteMap Editors

There are a number of other sitemap editors out there, however as with most tools, I would recommend starting with the one offered by Microsoft and seeing if it meets your needs before venturing into any third party tools.

OpenSource SiteMap Editor

If you are looking for an open source solution, there is a sitemap editor available through codeplex.


CRM Tool of the Week – CRM 4 to CRM 2011 JavaScript Converter Tool

Upgrading from CRM 4.0 to CRM 2011

If you are planning on upgrading from Dynamics CRM 4.0 to CRM 2011 you will definitely want to download this tool. Microsoft did an excellent job with the upgrade process for upgrading an organization from CRM 4.0 to CRM 2001. You should test any custom programming like custom workflows and plugins, as there are some oddities to the backwards compatibility of the SDK. But, for the most part upgrading is a seamless process with one exception, Form Scripts.

What’s Changed

There were some major changes to the object model which will cause nearly all form scripts to break when upgrading from CRM 4.0 to CRM 2011.

Here are some examples on how the Form Scripts have changed

CRM 4.0 CRM 2011
crmForm.all.new_field; Xrm.Page.getAttribute(“new_field”);
crmForm.all.new_field.DataValue = 0; Xrm.Page.getAttribute(“new_field”).setValue(0);
var newField = crmForm.all.new_field.DataValue; var newField = Xrm.Page.getAttribute(“new_field”).getValue();
var newField = crmForm.all.new_field.DataValue; var newField = Xrm.Page.getAttribute(“new_field”).getValue();

For a full list of all of the new Xrm.Page Methods download the Microsoft Dynamics CRM 2011 JavaScript Development Cheat Sheet by Daniel Cai.

Converting Form Scripts from CRM 4.0 to CRM 2011

Luckily there is a conversion tool available which will convert your CRM 4.0 Form Scripts to the new format for CRM 2011. It will not fix 100% of scripts, so you will need to test each scripts. But it will take care of the bulk of the work for you. When you go through your scripts you may also find that some of them are obsolete now because of features added in CRM 2011. Like scripts for hiding fields based on a users security roles, which can now be handled through Field Level Security.

Download the JavaScript Converter

You can download the CRM 4 to CRM 2011 JavaScript Converter from CodePlex.

CRM Migration Assistant

If the JavaScript Converter wasn’t easy enough Mitch Milam offers a CRM Migration Assistant that will go through your entire organization, pull all of the form scripts and upgrade them. That way you don’t have to go through all of your forms and copy each of the scripts into the JavaScript converter.

You can purchase the CRM Migration Assistant from http://blogs.infinite-x.net/crm-add-ons/crm-migration-assistant/ . There is also a trial version which will let you try it out and convert just the Accounts and Contacts.