JavaScript Bookmark Series – Part 3

Posted by on August 20, 2012  |  commentsComments (12)

Today’s bookmark will change all the labels of the fields on the form to their schema name.  If you are like me and keep the entity form open for reference then this bookmark will be very helpful to get a schema name quickly without needing to open the form customizations.

Add the following as your bookmark URL:

javascript:frames[0].Xrm.Page.ui.controls.forEach(function(a){a.setLabel(a.getName())});

The end result:

image

Comments

  1. One word: Whoa!

    You just saved me a ton of time and at the same time made me to smack my forehead - why didn't I figure out myself three years ago!? :)

    Thanks!

    Posted by: David  |  Aug 27, 2012 2:56:37 PM

  2. Pardon me for the stupid question, but all of my child windows open in application mode (without access to menu or ribbons). How are you accessing the bookmark from within the form?

    Posted by: James  |  Aug 28, 2012 7:20:09 AM

  3. James,

    You can open the Bookmarks window in IE with CTRL + I.

    Thanks,
    Blake

    Posted by: Blake Scarlavai  |  Aug 28, 2012 8:26:44 AM

  4. Actually, these are logical names. Schema names are not all lowercase.

    Posted by: skfd  |  Aug 28, 2012 9:31:39 AM

  5. Today’s bookmark will change all the labels of the fields on the form to their schema name. If you are like me and keep the entity form open for reference then this bookmark will be very helpful to get a schema name quickly without needing to open the form customizations.

    Posted by: Belle Littlefield  |  Sep 24, 2012 6:06:09 AM

  6. Blake-
    I'm anxiously awaiting more of these. These have helped me a ton!

    Here's a request; While it isn't supported, I have see a way to hide/show the Left Nav through script. I've tried to create one of these bookmarks but haven't been able to make it work.

    Here's the code I've used in actual form script (the form changed in RU 8, hence the two different snippets)

    Pre RU8
    //display the left nav, and set the form back to 1 column
    document.getElementById("crmNavBar").parentElement.style.display = "";
    document.getElementById("tdAreas").parentElement.parentElement.parentElement.parentElement.colSpan = 1;

    Post RU8
    //display the left nav, and set the form back to normal width
    document.getElementById("crmNavBar").parentElement.style.display = "";
    document.getElementById("tdAreas").parentElement.parentElement.parentElement.style.left = "185px";

    Posted by: James Reinhardt  |  Sep 24, 2012 11:08:51 AM

  7. Thanks James!

    Are you trying to hide/show the whole Left Nav area and not just individual links?

    Posted by: Blake Scarlavai  |  Sep 26, 2012 8:43:57 AM

  8. Blake-
    Yes. Show the whole left nav.

    We will frequently have forms that have the left nav hidden (through the form customizations) as the navigation isn't necessary for the users.
    As an admin, it can be nice to be able to access that info (Workflow for example), and creating a duplicate Admin Form isn't the best solution.

    Thanks for the response!

    Posted by: James Reinhardt  |  Sep 26, 2012 12:46:00 PM

  9. I looked into this a little bit and when I have the form set to hide the left nav bar, it appears that CRM doesn't render the left nav bar at all. Therefore document.getElementById("crmNavBar") doesn't exist to be able to show it.

    Posted by: Blake Scarlavai  |  Sep 27, 2012 2:36:33 PM

  10. Blake-
    That makes perfect sense.
    Thanks for looking into it, have a great weekend!

    Any more bookmarks coming in the future?

    Posted by: James Reinhardt  |  Sep 28, 2012 3:23:12 PM

  11. I currently don't have any plans for more but I'm always trying to come up with new ones. If you have any ideas, let me know!

    Posted by: Blake Scarlavai  |  Sep 29, 2012 4:17:36 PM

  12. Really awesome obervation and implemetaion... helped a lot...

    Posted by: Sudhanshu Sahoo  |  Dec 9, 2012 7:54:11 PM

Post a Comment

  • *Required

Contact Us for a Quote, or Personalized Demonstrationof Microsoft Dynamics CRM for Your Business.

Contact Us