crmForm.all[lookupField].DataValue not support in IE 10 RRS feed

  • Question

  • CRM version 2011 and onpremise

    I am trying to create Mutliselect lookup and I am saving the value to multilinetextbox which is hidden. it is saving the record properly.

    On view mode, I am trying to set the value of multilinetextbox to lookup field using below code

    crmForm.all[lookupField].DataValue = value

    Value is JavaScript object in having the lookup value. This solution is working fine in IE 9 but not working in IE 10.  DataValue  is coming undefined in IE 10.

    I have tried to set value using  xrm object code below but it is not giving any error and not showing value. Please suggest how to set the multiple value into lookup field


    Lookupfield is starndard lookup. to make it multi select I have set the lookupstyle property

    document.getElementById(lookupField).setAttribute("lookupstyle", "multi");

    Please suggest.













    Friday, August 30, 2013 1:39 PM

All replies

  • This code is not supported, and so you run the risk with any unsupported code that it will stop working after an update. It seems this has happened here.

    crmForm is deprecated CRM 4.0 JavaScript, which is no longer supported cross-browser (including IE 10), so you will only be able to use that code in IE 9 if HTC support is enabled in system settings. As you have already seen, this approach is also not possible using Xrm.Page.

    Perhaps you should consider some supported methods instead, such as using a N:N relationship instead of a multi-select lookup.

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Friday, August 30, 2013 11:29 PM
  • Please re-recheck following thread.


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

    Saturday, August 31, 2013 1:50 AM
  • Hi,

    Try this link for creating a lookup with multiple entities:



    Monday, September 2, 2013 6:07 AM
  • Hi Sonika,

    You need to update your code to match the JavaScript Standards as per CRM 2011. 

    Xrm.Page.getAttribute(lookupField).setValue(value); // Its the wrong way of setting a value to a lookup field

    Code Snippets to Get/Set Values to a look up field in CRM 2011

    Get a lookup value
    var lookup = new Array();
    lookup = Xrm.Page.getAttribute("attributename").getValue();
    if (lookup != null) {
        var name = lookup[0].name;
        var id = lookup[0].id;
        var entityType = lookup[0].entityType;

    Set a lookup value
    var lookup = new Array();
    lookup[0] = new Object();
    lookup[0].id = recorid;
    lookup[0].name = recordname;
    lookup[0].entityType = entityname;

    Alternate method to set lookup value
    Xrm.Page.getAttribute("attributename").setValue([{ id: recorid, name: recordname, entityType: entityname}]);

    Please vote as helpful or mark as answer if it has solved your query



    Happy coding 

    Monday, September 2, 2013 7:15 AM
  • Hi All,

    Thank for your reply.

    1. Regarding the setting value in lookup, In my case value is json object array.below code works fine for single entry.

    Xrm.Page.getAttribute("attributename").setValue([{ id: recorid, name: recordname, entityType: entityname}]);

    but when we try to set multiple value like below , doesn't work.

    Xrm.Page.getAttribute("attributename").setValue([{ id: recorid, name: recordname, entityType: entityname},  { id: recorid, name: recordname, entityType: entityname} ]);

    I also reference the above mentioned link but the problem is it allow the selection of multiple but onsave when you try to set the value of multiple in control it gives error.

    • Edited by SonikaJ Wednesday, September 25, 2013 6:10 AM
    Wednesday, September 25, 2013 6:09 AM
  • Hi SonikaJ

    Did u find solution for this.


    Friday, October 18, 2013 7:11 AM