locked
Disable a field in a Business Process with Javascript RRS feed

  • Question

  • Hi,

    I have a field on my Opportunity form which I would like to disable from JavaScript when another field is set to a certain value.
    The field appears on the form twice. Once in the body of the form and once in the business process associated with the form.

    If I use a business rule to disable the field then both the field on the form and the field in the business process is disabled.

    If I try and disable the field from JavaScript then only the field on the form is disabled.

    Does anyone know how I can disable the field in the business process as well as on the form using Javascript

    I am using CRM 2013 in the cloud

    The script I am trying looks some thing like : Xrm.Page.ui.controls.get("new_withinmarkets").setDisabled(true);

    Thanks

    Nic

    Wednesday, February 12, 2014 3:54 PM

All replies

  • I found the solution:

    Xrm.Page.getAttribute("name").controls.forEach(function (control, index) { control.setDisabled(true); });

    does the trick

    I found this at http://msdn.microsoft.com/en-us/library/jj602964.aspx#BKMK_AccessFormControls 

    Wednesday, February 12, 2014 8:04 PM