locked
CRM 2015 Xrm.Page.ui.controls.forEach bug on inactive record. RRS feed

  • Question

  • Hi all,

    There is a bug in CRM 2015 whereby if you have Xrm.Page.ui.controls.forEach on a deactivated record, it sets the value of the statuscode back to an active one. This means that if you do an Xrm.Page.getAttribute("statuscode").getValue() afterwards it will return an incorrect value. The screen remains correct and the isDirty flag is not set so doesn't force a save.

    To recreate this issue. On an entity with a status code  on the form have the following script on the page load. Deactivate the record and refresh the page....

    function onLoad(){
        alert(Xrm.Page.getAttribute("statuscode").getValue());
        Xrm.Page.ui.controls.forEach(function(control, index){});
        alert(Xrm.Page.getAttribute("statuscode").getValue());
    }

    Thought I would let everyone know as it took me ages to work out what was going wrong :-(

    Chris

    Tuesday, March 31, 2015 8:34 PM