How to set a lookup Value using javascript

Unanswered How to set a lookup Value using javascript

  • quinta-feira, 17 de maio de 2012 08:19
     
      Contém Código

    Hi 

      I have a  "country"  look up field in Contact entity.When i select an account in contact i want to auto populate the Country field.

     I have the following code

      

    var lookupData = new Array(); var lookupItem= new Object(); //Set the id, typename, and name properties to the object. lookupItem.id = countryId; //GUID lookupItem.typename = 'country'; lookupItem.name = countryname; // Add the object to the array. lookupData[0] = lookupItem;

    Xrm.Page.getAttribute("new_country").setValue(lookupData);

    This code is displaying the country value in Look Up field but the image is not displaying and when clicking on the country

    its not opening.

    Can anybody help me

    Thanks


    Thanks