Monday, June 7, 2010

Simple CRM Tools

A colleague of mine recently turned me onto some very useful tools that are simple and easy use. Often times as a CRM developer, we find ourselves needing either the entity type code or the GUID of the record we’re on.  We can easily obtain this information by creating a bookmark that displays either the GUID or the entity type code, directly from the form we’re on.  As an added benefit, we can also set the values to our clipboard so they can be pasted as needed.

To create these bookmarks, just browse to any CRM page and add it to your favorites.  Then, you can edit the bookmark and set the URL to the javascript you would like executed.

Here's the javascript to do so:

Entity Type Code:
javascript:if (crmForm.ObjectTypeCode){clipboardData.setData("Text", crmForm.ObjectTypeCode.toString()); alert(crmForm.ObjectTypeCode);}

Entity ID:
javascript:if (crmForm.ObjectId){clipboardData.setData("Text", crmForm.ObjectId.toString()); alert(crmForm.ObjectId);} else { alert('No id yet!'); }

Another useful bookmark is to find the Fetch XML used by an Advanced Find query.  To do this, create a bookmark using the below javascript, then create a query in advanced find and click Find.  Once your results are displayed, click the bookmark you just created to display the Fetch XML and copy it to your clipboard.

Fetch XML:
javascript:if (document.getElementById('fetchxml')){clipboardData.setData("Text", document.getElementById('fetchxml').value.toString()); alert(document.getElementById('fetchxml').value);}


  1. Great tips!
    These work best if you have configured IE to open popups in tabs rather than new windows, or use CTRL-N to re-open the form full screen so you can get at the toolbars (or configure keyboard shortcuts for the bookmarks)

  2. Thanks!...and that is a good point.