CRM 2011 JAVAScript issue - Field Requirement RRS feed

  • Question

  • I found and used a good easy javascript example online to change a Field to be "required" if an option set is set to Yes.

    The code works great, however, it does not reset the field to None if you select no, it leave the field as Required.

    I'm sorry I do not have the example code with me right now, it's at work, but I've been meaning to post this question.

    Example:  Two Option set field named po_Storage.  If you select Yes, then Field po_StorageWeight is set to Required.

    If you select No for po_Storage, po_StorageWeight should revert back to None but it is staying as Required.

    Anyone have any suggestions?

    Thank you in advance

    Tuesday, April 14, 2015 2:39 AM

All replies

  • Hello,

    Try to use following code for onchange of po_Storage field:

    Xrm.Page.getAttribute("po_storageweight").setRequiredLevel(Xrm.Page.getAttribute("po_storage").getValue() ? "required" : "none");

    Dynamics CRM MVP
    My blog

    Tuesday, April 14, 2015 5:25 AM