locked
JScript InserValue in CRM 2011 RRS feed

  • Question

  • Hi, I am trying to find a replacement for CRM 4 jscript method InsertValue. For exempel crmForm.all.description.InsertValue("") appends text to field, but is there a method for CRM 2011? Or must I use string concatenation with previous value?

    Thanks in advance


    Zarko

    Wednesday, July 31, 2013 7:40 AM

All replies

  • Hi,
    you can use string concatenation, it is the supported way, similar to this code:

    var description = Xrm.Page.getAttribute("description").getValue();
    description += "append here new text";
    Xrm.Page.getAttribute("description").setValue(description);

    or you can create a function like this:

    function AppendText(field, text) {
       var fieldValue = Xrm.Page.getAttribute(field).getValue();
       if (fieldValue != null) {
          fieldValue += text;
       } else {
          fieldValue = text;
       }
       Xrm.Page.getAttribute(field).setValue(fieldValue);
    }


    My blog: www.crmanswers.net



    Wednesday, July 31, 2013 7:45 AM
  • Yes, I know that, I was just looking for a replacement for InsertValue.

    Zarko

    Wednesday, July 31, 2013 8:10 AM