We have 6 address individual address fields that need to be aggregated into a separate 'Address Block' field. The current code used to autopopulate the 'Address Block' field works on contacts but not on accounts. This is because the root name of the state field at account level is different from the root name of the state field for the contact. The current code uses the contact state field name.
Is it possible to point a Java Script at an individual entity within CRM11? Below is the JScript in question:
//--- AUTOPOPULATE ADDRESS BLOCK
function autopopulateAddressBlock() {
var address_block = "";
if (Xrm.Page.getAttribute("address1_name").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_name").getValue() + "\n";
}
if (Xrm.Page.getAttribute("address1_line1").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_line1").getValue() + "\n";
}
if (Xrm.Page.getAttribute("address1_line2").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_line2").getValue() + "\n";
}
if (Xrm.Page.getAttribute("address1_line3").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_line3").getValue() + "\n";
}
if (Xrm.Page.getAttribute("address1_city").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_city").getValue() + ", ";
}
if (Xrm.Page.getAttribute("tprnew_state").getSelectedOption().text != null) {
address_block = address_block + Xrm.Page.getAttribute("tprnew_state").getSelectedOption().text + " ";
}
if (Xrm.Page.getAttribute("address1_postalcode").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_postalcode").getValue() + "\n";
}
if (Xrm.Page.getAttribute("address1_country").getValue() != null) {
address_block = address_block + Xrm.Page.getAttribute("address1_country").getValue() + "\n";
}
Xrm.Page.getAttribute("tpr_addressblock").setValue(address_block);
}
*This post is locked for comments