locked
crmForm.all question RRS feed

  • Question

  • Hello - I've been using the XRM method of crmForm.all in my js resources to get a handle to the fields on CRM forms. However, it doesn't look like I can use that method through the F12 console ("crmForm is undefined").

    Is there some type of script reference I can include in the F12 console in order to be able to reference crmForm in the console?  Thanks!

     

    Wednesday, June 19, 2013 8:10 PM

All replies

  • There are a couple of things to check here.  First, the use of crmForm is deprecated and you should use the Xrm.Page object instead.  More information on writing client side extensions for CRM can be found in the CRM 2011 SDK.  Instead of crmForm.all.yourfield.DataValue you should use the function Xrm.Page.getAttribute("yourfield").getValue().

    Another thing to check is that you are using the correct window context.  The un-customized out of the box CRM form contains an IFRAME for the actual form contents.  This is the IFRAME that you will need to reference in order to get at the controls and values of fields on the form when using the F12 console.  For example, window.frames[0].window.Xrm.Page.getAttribute("yourfield").getValue();


    Nick


    Saturday, June 29, 2013 3:52 AM
  • Hello,

    If you want to convert your javascript using crmFrom to Xrm, you can use this program:
    http://crm2011scriptconvert.codeplex.com/

    Saturday, June 29, 2013 9:00 PM