The Return of ‘Copy a Link’ to CRM 2013 Forms as Bookmarklet

Paul Nieuwelaar, 23 July 2014

Dynamics CRM 2013 for some reason has decided to remove the Copy a Link button from forms, and instead only shows the Email a Link button. The button still exists on views, however I often find myself on a form wanting to get the URL of the record so I can do something with it. Since the record URL is no longer available in the address bar, the only option is to pop the record and then copy the ID, or use Email a Link and copy it out of the email (doesn’t work if you’re on a server with no email client).

Since custom bookmarklets seem to be trending right now, I decided to make my life a little bit easier by creating a custom bookmarklet to copy the record URL. Since the button still actually exists, and is just hidden in the new UI, it was easy enough to open up the Ribbon Workbench and examine the function being called from the button. It was then just a matter of testing it out to see what parameters the function actually requires (which turns out it doesn’t need any). And finally just combining that with the JavaScript to get the active forms iframe, as found by Jared Johnson in his blog post on creating custom bookmarklets.

To add this custom bookmarklet, create a new bookmark called ‘Copy a Link’, and set the URL to use the following script:

javascript:$("iframe").filter(function () { return ($(this).css('visibility') == 'visible') })[0].contentWindow.Mscrm.CommandBarActions.sendFormShortcut();

When we click the button, the CRM function will fire to copy the record URL, and we can see the link pasted into Notepad exactly how CRM 2011 would. This button will only work on an open record, and not on a list view for example (although the CRM command bar button still exists on views). It will also be available and will work on any CRM 2013 environment you log into, so there’s no need to install any additional solutions or add-ins.

Stay tuned for more bookmarklets coming soon!