Insights
Bringing our best ideas and thinking to you.
Blog Post
August 24, 2016
Share this page:
Using Bookmarklets to Access Hidden CRM Page Content
By Shawn Lautebach
Accessing the internals of Dynamics CRM pages can make your development life easier. Instead of digging through the source of the page or flipping to and from solution configuration information to find what you need, using JavaScript bookmarklets can enable you to quickly surface CRM internal information and capabilities right from the page itself. In this article we describe the approach and present our implementation of several CRM bookmarklets for you to use.
What are bookmarklets?
Bookmarklets take advantage of the fact that browser bookmarks and links can contain JavaScript, not just simple URLs.
Using JavaScript in a bookmark allows us to store one-click functions in the browser that can perform a wide variety of operations, such as running a search query or extracting data from a table. For example, clicking on a bookmarklet after selecting text on a webpage could run an Internet search on the selected text and display a search engine results page.
See Wikipedia for more detail on bookmarklets.
The power of bookmarklets & CRM
As you probably know, CRM web pages contain significant amounts of client-side data structures and functionality, not all of which are available through the application interface itself. Using bookmarklets provides a fast, highly-accessible and re-usable way to access this content during development. This gives us several very useful and interesting things we can do, for instance getting the internal record ID (GUID) for a record being viewed, viewing the schema names for fields and enabling or disabling fields - all with one click and without leaving the CRM page itself.
The AHA CRM bookmarklets collection
The AHA CRM team uses bookmarklets frequently and we've developed a set of our most commonly-used bookmarklets which we are making available for wider use. If you want to get started and begin using them, you can download and save the Bookmark Import file and use your browser bookmark import functionality to import them into your browser. If the import fails (some browsers need more technical hijinx than others), you can download the Bookmarklets.html file, save it to your computer and open it up in your browser. From there you can click and drag any of the links to your bookmark/favorites folders or toolbar just like you would for any other link.
Included in the AHA bookmarkets are the following handy utilities:
- Copy record ID - Copies the record id (GUID) to the clipboard. If copy to clipboard is not supported then provides you with a prompt window to copy the link.
- Copy record link - Copies the link to the record to the clipboard. If copy to clipboard is not supported then provides you with a prompt window to copy the link.
- Enable all fields - Enable all fields on the form.
- Open performance report - Opens the PerformanceUI window, if supported by your version of CRM.
- Refresh form data - Asynchronously refresh the form.
- Save and refresh form data - Asynchronously save and refresh the form.
- Show all fields - Sets the visibility to true for all fields on the form.
- Show dirty Fields - Alerts a message listing all the dirty attributes (fields that have changed) on the form.
- Show option set values - Opens up a window and displays the option set and their possible values.
- Show schema names - Changes all the labels on the form to display their schema names instead of their display names.
Here's an example of the 'Show schema names' bookmarklet used to show the schema names for the fields on an activity:
Find out more and help us improve bookmarklets
We've shared the bookmarklets project on GitHub. If you're interested in the details of how this all works and/or want to write your own bookmarklets, feel free to get started and clone the repository. You can also find out lots more technical detail there on the project page.
Gotchas and disclaimers
- Bookmarklets are meant as a tool for CRM developers, not for production deployment or use by end-users
- If you understand bookmarklets, it should also be fairly obvious that their dependencies within the CRM page could easily be disrupted by new versions of CRM. Also, of course, accessing the CRM application in this way is not supported by Microsoft
- Finally, the AHA bookmarklets project is provided as-is, with no warranty or support from AHA, express or implied. You may use it as described in the MIT license on GitHub.