Most of the time when we developed some new functionality in crm, we need current entity record GUID for debugging and checking our modification using advanced find , Odata query etc.
In this blog I am going to create a simple bookmarklet for getting current enity record GUID.
What is Bookmarklet?
A small software application stored as a bookmark in a web browser, which typically allows a user to interact with the currently loaded web page in some way.
(definition from google)
For more details on bookmarklet creation refer below link
http://code.tutsplus.com/tutorials/create-bookmarklets-the-right-way–net-18154
Let’s write a JavaScript code that we use for our bookmarklet.
javascript;
(function () {
(document.querySelectorAll(‘iframe’)).forEach(function (frame, v) {
if (frame.style.visibility !== ‘hidden’) {
if (frame) {
var Xrm = frame.contentWindow.Xrm;
prompt(“Copy GUID for the current record”, Xrm.Page.data.entity.getId());
} else {
alert(‘Entity form not detected’);
}}
})
})();
Now add a new page on chrome from bookmark bar
In name give some meaning name like ‘GETID’ and in URL paste our JavaScript code
Now try this on Entity Form, we’ll get the GUID of current record.
That’s it. Hope it’ll help someone 🙂
Thanks for visiting my blog!!!
Nice. ☺
LikeLike