Retrieving a Record's GUID in Microsoft Dynamics CRM 2013

In past versions of CRM, retrieving a record's ID (GUID) was possible through a number of methods.  In CRM 2013 these methods are somewhat limited and a work-around is necessary in order to easily obtain the GUID.  I found that I primarily wanted to quickly copy the GUID of the record I was viewing.  Based on my preference I researched a method which would allow me to easily find the GUID and also copy the value to the clipboard.

My solution involved creating a javascript bookmarklet.  If you aren't familiar with javascript bookmarklets they are essentially bookmarks which contain jscript which will execute on the page you are viewing.  A javascript bookmarklet can be created in IE, Chrome, or another browser of your choice.

  1. Create a new bookmark.  I like to add the bookmark to my Favorites Bar in IE so that it is accessible.
    Add bookmark
  2. Find the newly created bookmark then right click and select Properties.  On the General Tab rename the bookmark and call it "Retrieve GUID".
  3. Navigate to the Web Document Tab and delete the existing data in the URL field.
  4. Paste the following into the URL portion of the new bookmark:javascript:var guid=frames[0].Xrm.Page.data.entity.getId();var str1=guid.replace(/{/g,""); var copy=str1.replace(/}/g,"");(function(){window.prompt("Copy to clipboard: Ctrl+C, Enter", copy);})();Bookmark url properties
  5. Save your bookmark.

To test your new javascript bookmarklet, navigate to a single record in CRM and simply click your newly created Retrieve GUID bookmark.  The following window will display when the bookmark is clicked while viewing a record in CRM:

Copy guid

 

by Customer Effective

 

3 thoughts on “Retrieving a Record's GUID in Microsoft Dynamics CRM 2013”

  1. When running on a specific account's page.

    SCRIPT5007: Unable to get property 'entity' of undefined or null reference
    main.aspx, line 1 character 1

Comments are closed.

Show Buttons
Hide Buttons