Quantcast
Channel: Jason Lattimer's Groups Activities
Viewing all articles
Browse latest Browse all 869

Dynamics CRM 2016 Javascript - Set address fields values based on selection from option set value

$
0
0

Working fine on CRM 2011 . the address is retrieved from the organisation addresses correctly and is displayed in the option set. However when trying to set the fields when selecting the billing address on change, nothing seems to populate on the address line fields.

Expected to populated address lines based on selection from the optionset. 

function setAddressFields() {

if (addresses == null) return;

var billingAddressOS = Xrm.Page.getAttribute("new_billingaddress");

var addressOS = document.getElementById("new_billingaddress");

if (addressOS.selectedIndex != 0)

{

var i = addressOS.selectedIndex - 1;

Xrm.Page.getAttribute("new_addressname").setValue(addresses[i].Name);

Xrm.Page.getAttribute("new_street1").setValue(addresses[i].Line1);

Xrm.Page.getAttribute("new_street2").setValue(addresses[i].Line2);

Xrm.Page.getAttribute("new_street3").setValue(addresses[i].Line3);

Xrm.Page.getAttribute("new_city").setValue(addresses[i].City);

Xrm.Page.getAttribute("new_county").setValue(addresses[i].County);

Xrm.Page.getAttribute("new_postcode").setValue(addresses[i].PostalCode);

}

else {

Xrm.Page.getAttribute("new_addressname").setValue(null);

Xrm.Page.getAttribute("new_street1").setValue(null);

Xrm.Page.getAttribute("new_street2").setValue(null);

Xrm.Page.getAttribute("new_street3").setValue(null);

Xrm.Page.getAttribute("new_city").setValue(null);

Xrm.Page.getAttribute("new_county").setValue(null);

Xrm.Page.getAttribute("new_postcode").setValue(null);

}

}


Viewing all articles
Browse latest Browse all 869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>