CRM 2013 – quick way to get the guid on a form

I had previously written an blog about this

https://crmbusiness.wordpress.com/2011/02/21/crm-2011-quick-way-to-find-a-guid-using-a-crm-form/

and the method involved getting the url and copying out the guid from it, which is a bit slow and painful, particuarly on non default entities because there are two guids in the url and I keep forgetting which one I need.

Also someone informed the url is no longer displayed in CRM 2013!

Then a comment from Michael Blackburn gave me a much simplier solution, which I thought I should share because it’s certainly made my life a lot easier.

Press F12 to open the developer console, Click the script tab, and in the bottom right, next to the >> type in:
frames[0].Xrm.Page.data.entity.getId()

If you need to call any Xrm function from the context of the javascript console, you can do so by prefacing it with frames[0].

 

capture guid

 

 

Here is video link, showing you how to get the guid in Chrome and IE in CRM 2013

http://www.youtube.com/watch?v=FVs2A5-jH-8

Advertisements

16 thoughts on “CRM 2013 – quick way to get the guid on a form

  1. henryjammes January 15, 2014 / 10:29 am

    In Internet Explorer I use favorites to inject JavaScript into the form and get the GUID.
    Here is the “URL” I use to inject the JavaScript (I press CTRL + I to access the favorites if no menu is available)
    javascript:alert(frames[0].Xrm.Page.data.entity.getId());
    I can then copy the content of the JavaScript alert pop-up.

    Like

  2. AdrianR January 15, 2014 / 11:13 am

    And if you’re using the Outlook client for CRM, you can press [Ctrl]+N to open the current form in Internet Explorer.

    Like

  3. raj January 15, 2014 / 8:53 pm

    you can run cd(frames[0]) before running this. this eliminates the need to constantly prefix frames[0] when executing commands from console. in chrome you can simply choose the frame on which the js will be executed, but not in IE.

    Like

  4. Helen Warn July 4, 2014 / 9:13 pm

    Thank you, thank you, thank you!
    You just saved me hours of misery 🙂

    Like

  5. Mike kolling August 8, 2014 / 11:38 am

    Doesnt work for me
    Unable to get property ‘entity’ of undefined or null reference

    Like

    • Seamus November 19, 2014 / 10:46 am

      Mike, I was getting this error too – in IE11, in the console window, make sure your target is _top:main.aspx and just enter Xrm.Page.data.entity.getId() This worked for me.

      Like

  6. Steven September 23, 2015 / 9:53 am

    This page is my browser’s top most crm favourite. Thanks Hosk.

    Like

    • Hosk September 23, 2015 / 10:13 am

      There is an easier way using javascript bookmarklets, I will blog about it this week or next week.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s