locked
Is document.getElementById('something') supported in CRM 2011? RRS feed

  • Question

  • Is document.getElementById('something') supported in CRM 2011? If not is there some xrm.page code that can substituded in its place?
    Tuesday, June 25, 2013 2:09 PM

All replies

  • Hi ,

    document.getElementById('something'), will support in all areas.

    crmForm.all[fieldname] will not support.

    Tuesday, June 25, 2013 2:13 PM
  • No technically this isn't supported. Really working with form elements through Xrm.Page is the only supported way.

    Once you have the element, what are you trying to accomplish?

    Look through the SDK to see if there is a supported way to handle what you are trying to do.

    Client-Side Programming Reference


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Tuesday, June 25, 2013 2:16 PM
    Moderator
  • Hi,

    Any DOM manipulations that access a document element by it's id (such as getElementById) or position in the tree are unsupported. The only supported way of accessing form data is to use the Xrm SDK Javascript object model.

    "The Microsoft Dynamics CRM development team reserves the right to change how pages are composed, including the ID values for elements, so using the Xrm.Page object model protects your code from changes in how pages are implemented." taken from http://msdn.microsoft.com/en-us/library/hh771584.aspx#BKMK_JavaScriptBestPractices

    There is a great quick reference in the SDK for supported mechanisms - http://msdn.microsoft.com/en-us/library/jj602964.aspx

    hth


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, June 25, 2013 2:16 PM
    Answerer
  • Hi, 

             I have written the javascript code for crm 2011, but after crm upgradation to 2013,  that code not working in crm 2013. 

       so i need to change below code:

         document.getElementById("new_product").setAttribute("lookupstyle", "multi");

        Can anyone help on this. 

        Thanks in advance


    Nagaraj

    Wednesday, October 23, 2013 6:23 AM
  • Does anyone has a solution for this.

    Thanks in advance.

    Monday, December 2, 2013 1:37 PM
  • Hi Jeff,

    are you asking for replacement code for document.getElementById or changing the lookup style to multi.

    regards,


    Nagaraj

    Monday, December 2, 2013 1:43 PM
  • Hello Nagaraj,

    Im just looking for the replacement code for the document.getElementById. In my case, i just wanted to limit the customer lookup to only accounts (not both accounts & contacts) FOR CRM 2013 support.

    Thanks,

    Jeff

    Monday, December 2, 2013 2:14 PM
  • Does anyone has a solution for this.

    Thanks in advance.

    Saturday, July 8, 2017 7:21 AM