locked
Except for Polaris forms all classic forms have null Xrm.Page.data and Xrm.Page.ui RRS feed

  • Question

  • Hi,

    No matter what I try I can't get Xrm.Page.data from forms other than Proccess Forms. When I change to classic forms Xrm.Page.data is always null.

    Other forms have the same problem. Like my Product Form. Here is a simple code that isn't working:

    function DisableVendor() {
    Xrm.Page.getControl(“VendorName”).setDisabled(true);
    }
    I get an undefined error right from getControl function.

    I'm working on CRM Online with rollup 13.

    Thank you for any help!

    Sunday, June 30, 2013 10:26 PM

All replies

  • The Polaris forms as of now do not support scripts. When script libraries are included in the form, the forms are configured to automatically open in the classic UI.

    The future versions of CRM have plans to support scripts on the process-driven UI until then you need to use classic forms if you need any scripts to be included in your forms.

    HTH

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed as answer by Sam - Inogic Monday, July 1, 2013 4:05 AM
    Monday, July 1, 2013 4:05 AM
  • Hi,

    No matter what I try I can't get Xrm.Page.data from forms other than Proccess Forms. When I change to classic forms Xrm.Page.data is always null.

    Other forms have the same problem. Like my Product Form. Here is a simple code that isn't working:

    function DisableVendor() {
    Xrm.Page.getControl(“VendorName”).setDisabled(true);
    }
    I get an undefined error right from getControl function.

    I'm working on CRM Online with rollup 13.

    Thank you for any help!

    You have two errors inside your script:
    1) for the fieldname you need to use the logical name instead the schema name, this means all lowercase letters (vendorname)
    2) you are using smart quotes (“ ”), you need to use single or double quotes (' ' or " ")

    so the code will be:

    function DisableVendor() {
    Xrm.Page.getControl("vendorname").setDisabled(true);
    }
    
    // or
    function DisableVendor() {
    Xrm.Page.getControl('vendorname').setDisabled(true);
    }


    My blog: www.crmanswers.net


    Monday, July 1, 2013 6:06 AM