locked
Microsoft Dynamics CRM 2011 - Optionset JavaScript RRS feed

  • Question

  • Hi,

    I have a optionset on the accounts entity and a multiple lines of text field on the form. When you select different options on the optionset, I have written some javascript which generates text in the  multiple lines of text field. This works fine, except when I have selected numerous options and text has been generated, when I select the null the text in the multiple lines of text field is not cleared. I have the below code, can anyone explain to me why this doesnt fire (exception is generated).

    if(Xrm.Page.getAttribute("optionset").getSelectedOption() != null)
     {
      Xrm.Page.getAttribute("multiplelinesoftext").setValue(null);
     }

    Thanks

    Tuesday, November 12, 2013 8:38 AM

Answers

  • Hi,

    Try this

    if (Xrm.Page.getAttribute("optionset").getSelectedOption() == null) {
        Xrm.Page.getAttribute("multiplelinesoftext").setValue("");
    }


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    • Marked as answer by samrr1875 Wednesday, November 20, 2013 11:46 AM
    Tuesday, November 12, 2013 9:01 AM