web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Is it possible to read Div element of entity form using Javascript in CRM 2015 ? I tried document.getElementById("") not working....

(0) ShareShare
ReportReport
Posted on by

I am trying to read Dive element on entity form using javascript so that I can change the style of that perticular element. I tried document.getElementById("") not working..

For example : Below statement is not working. Showing null value.

var customControl = document.getElementById("header_notescontrol");

*This post is locked for comments

I have the same question (0)
  • Rajkumar Rajaraman Profile Picture
    on at

    Is this what you are looking for?:

    www.mscrm.in/.../get-form-name-of-entity-using.html

  • Suggested answer
    Sartaj Profile Picture
    880 on at

    Hi Ganesh,

    First I want to mention that it is not supported way for customization, any attempt to access DOM was never entertained by Microsoft. 

    Though we can make use of these methods of DOM manipulation in previous versions of MS dynamics crm before this latest update(MS dynamics crm 2015 update 1).In this update they introduction new form rendering engine and also change the way to manage javascript and 3rd party library.

    But there is a way if you still want to use access DOM.

    Navigate to Settings -> Administration -> System Settings -> General

    At the bottom of the form select “YES” under “Use legacy form rendering” and click OK button to save.

    clear chase your browser and check

    Hope this help, thanks.

    Sartaj

  • Sartaj Profile Picture
    880 on at

    Hi Ganesh,

    Have you found this working for you?

    Sartaj

  • Community Member Profile Picture
    on at

    Hi Sartaj,

    thanks for your response..

    I am able to read the element with your solution. but I am facing one issue that is..

    I am using pure Java script. The java script code is getting executted before the CRM page is loaded conmpletely. Because of this below code is returning null value..

    var controlEle = document.getElementById(DivelemetName);

    but when I add alert method and take time to click "Ok" then  it is working fine..

    So basically some javascript code has to be return to control the code till CRm form is loaded completlly tghen after the JS code should run..

    tried many thing but didn't get any thing..

  • Royal King Profile Picture
    27,686 on at

    use setTimeout function to delay executing your script until control object is not null

    something like below should work

    function setCtrlStyle(){

    if (document.getElementById(DivelemetName)) {

       }

       else {

           setTimeout("setCtrlStyle();", 500);

       }

    }

  • Sartaj Profile Picture
    880 on at

    Hi Ganesh,

    You can use timer in this scenario as suggested by Chitra, thanks.

    Sartaj

  • MilindP Profile Picture
    1,019 on at

    It will work for now as specified by Sartaj, but may be in future release it will again you a problem.....

    BTW what is the purpose of using it..... just wanted to check if there is any other way of implementing it using supported method

  • Community Member Profile Picture
    on at

    I need to hide "Complete" button from Social pane for phone call activity Or if I can write some javascript validation when user clicks Complete button from Social Pane.

  • Sartaj Profile Picture
    880 on at

    We do not have social pane control so we can not go with supported way.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans