locked
Disabled Form fields enabled on Activate RRS feed

  • Question

  • I have a custom entity where the Form has fields that have "Field is read-only" checked.  When I am on an Inactive record the fields show the lock and cannot be modified - all good so far.  When I click on the Activate option the fields become unlocked and the User can edit the fields - big problem.

    I thought I could write some JS to disable during the OnLoad but the OnLoad event does not fire.  I see where I can tap into what type of Save is executed and can send an alert to screen that the OnSave of Activate executes but this is prior to the screen refresh which frees the fields.

    Has anyone found a work-around to this feature?


    Bruce A. Jones Solutects LLC

    I found the issue mentioned over in Connect but no work-arounds listed there yet.  https://connect.microsoft.com/dynamicssuggestions/feedback/details/850688/read-only-fields-get-enabled-when-record-is-reactivated-crm-2013#tabs

    If you have a work-around or would like to bump this item up the bug list please follow the link.

    • Edited by BAllen66 Thursday, May 1, 2014 10:40 PM
    Thursday, May 1, 2014 9:17 PM

Answers

  • Hi,

    Sounds like a bug in CRM2013.

    As an interim fix, you may want to try this workaround. It's not pretty but its works.

    Attached this function to the OnSave Event of your custom entity form(s). It basically detects a reactivation and refresh the screen which locks the fields as per your design.

    function relockreadonlyfield(context) {
        var eventArgs = context.getEventArgs();
        if (eventArgs.getSaveMode() == 6) {
     setTimeout("window.location.reload(true);", 500);
        }
    }


    Eric UNG [Senior Analyst Programmer :: Sydney, Australia]

    • Proposed as answer by Ronald Liu Friday, May 2, 2014 5:54 AM
    • Marked as answer by BAllen66 Friday, May 2, 2014 10:27 AM
    Friday, May 2, 2014 5:30 AM

All replies

  • Hi,

    Sounds like a bug in CRM2013.

    As an interim fix, you may want to try this workaround. It's not pretty but its works.

    Attached this function to the OnSave Event of your custom entity form(s). It basically detects a reactivation and refresh the screen which locks the fields as per your design.

    function relockreadonlyfield(context) {
        var eventArgs = context.getEventArgs();
        if (eventArgs.getSaveMode() == 6) {
     setTimeout("window.location.reload(true);", 500);
        }
    }


    Eric UNG [Senior Analyst Programmer :: Sydney, Australia]

    • Proposed as answer by Ronald Liu Friday, May 2, 2014 5:54 AM
    • Marked as answer by BAllen66 Friday, May 2, 2014 10:27 AM
    Friday, May 2, 2014 5:30 AM
  • This bug still exists with UR2 applied. Eric's workaround works like a charm!

    Ronald

    Friday, May 2, 2014 5:54 AM
  • Works - Thanks!

    Bruce A. Jones Solutects LLC

    Friday, May 2, 2014 10:27 AM