locked
How to set form read only in CRM 2013 RRS feed

  • Question

  • Hi,

    I want to set form read only. May I use this API in CRM 2013

    Xrm.Page.ui.setFormType(1)


    Friday, January 9, 2015 9:02 AM

All replies

  • Hi,

    I dont think that there is such a method in Xrm Library. You can use the below function with passing true parameter

    function formdisable(disablestatus) { var allAttributes = Xrm.Page.data.entity.attributes.get(); for (var i in allAttributes) { var myattribute = Xrm.Page.data.entity.attributes.get(allAttributes[i].getName()); var myname = myattribute.getName(); Xrm.Page.getControl(myname).setDisabled(disablestatus); } }



    If you find this post helpful then please Vote as Helpful and Mark As Answer. Thanks and Regards, Polat Aydın My blog



    Friday, January 9, 2015 9:15 AM
  • Hi,

    Also try with this..

    function ReadOnly ()
    {
        var controls = Xrm.Page.ui.controls.get();
        for (var i in controls)
        {

            var control = controls[i];
            if (!control.getDisabled())
            {
                control.setDisabled(true);
            }
        }
    }

    Helpful link :http://www.mscrm.in/2014/04/how-to-make-ms-crm-form-read-only-by.html#.VK-iniTTm1s

    Thanks

    • Proposed as answer by Suresh Sorde Friday, January 9, 2015 9:45 AM
    Friday, January 9, 2015 9:44 AM