Based on the last post about retrieving Microsoft Dynamics CRM record based information from the console ‘Dynamics CRM – Access GUID from the browser console‘, I thought I write up some other useful bits that can be used to get information in a pinch.
Most of these have be run from the viewport where the record in question is open, unless otherwise stated.
Get an entity’s origin
This is particularly handy when you want to know the logical name to work with programmatically. All this without having to open up the solution or form and plow through a few forms and several clicks.
Get logical name for controls in the controls collection
The controls collection is a child of the ui object, which itself is a child of the Xrm.Page object. [See the visual layout on MSDN]. The index allows retrieval of control items as they occur on the form.
Get logical name for control based on display name
Now there are no direct method calls, that I found or aware of, that could get you the logical name for a field based on its display name. Which is a big shame because that would be a very useful one.
Now this might be somewhat tedious based on what wants to be achieved, and most definitely based on the number of fields on the form, as the user will have to randomly call the setFocus() method on a guess of where the control might be in the index based on position i.e. if the field is placed in the middle of the list of fields, chances are the index will be roughly half of the length of the count of fields.
But once the focus reveals the field that the user is interested in, the previous method getName() can be used to retrieve the logical name using that same index.
These calls are part of the Xrm.Page model which can be referred to on the MSDN site. However, they can be utilized for quick little views at relevant information via the browser’s console.