Raghu
Raghu

Reputation: 151

How to access the <div> element / DOM object from the dynamics CRM form 2016

I need to change the background colour of the CRM form notification element in the CRM dynamics 2016 for trial purposes. I know it's unsupported but this is for end user trial. the div element details are as follows-

<div class="Notifications Notifications-strict Notifications-strict-bottom" id="crmNotifications" style="height:; display: block;" size="3" maxheight="51">

I've tried using the window.parent.getElementById('crmNotifications').style.backgroundColor;

but with no luck. i've also heard that DOM element is not accessible from the entity form. is there a way i can change the background color.

Upvotes: 1

Views: 2477

Answers (2)

Milton
Milton

Reputation: 45

You need to create a HTML web resource, add it to the form and use window.parent to access the DOM.

For example:

<html>
 <head>
  <script>
    window.parent.document.getElementById("crmNotifications").style.backgroundColor = "blue"
  </script>
 </head>
 <body>
 </body>
</html>

Upvotes: 1

Cavan Page
Cavan Page

Reputation: 535

document.getElementById("crmNotifications").style.backgroundColor = "blue"

Upvotes: 1

Related Questions