In this recipe, we will take a look at how to bring a section of the form to the attention of the user. We can do this for various reasons, whether we want to let the user know that a section is more important than the others, or simply to decorate our form.
We can either use one of the previously created solutions, or create a new solution. We will need to be either a system administrator or a system customizer.
Perform the following steps to highlight a section to the user by changing the background color of that section. We will be using the Account entity for this customization, and we will create a new section. We could do the same on an existing section.
new_JSAccount
. Make it of type Script (JScript).function HighlightSection() { document.getElementById("{be295314-4459-5e75-68de-81921170754b}").style.backgroundColor = '#CD0000'; }
OnLoad
event of the form.While this is an unsupported customization, it's been available since previous versions of Dynamics CRM, and it's still an easy and comfortable way of handling user-interface changes.
The line of code in our function gets a reference to the section, and applies a background-color style formatting. We can easily get the internal ID of the section by using the Internet Explorer Developer Tools console. We have focused on using the Developer Tools in our debugging section in Chapter 6, Debugging.
There are some additional ways to interact with the user interface. Some of them involve the use of other external libraries, such as jQuery. We will be looking at how to use jQuery in Chapter 9, Extending CRM Using Community JavaScript Libraries.
3.148.144.139