I am trying to set address fields null on a crm form if another field value =1. The issue is that the fields on the form are the address composite fields and the script does not seem to be working with these fields.
function clearAddress() {
var clear = Xrm.Page.getAttribute("orbus_clear").getValue();
if (clear == 1) {
Xrm.Page.getAttribute("address1_composite_compositionLinkControl_address1_line1_d").setValue(null);
Xrm.Page.getAttribute("address1_composite_compositionLinkControl_address1_line2_d").setValue(null);
Xrm.Page.getAttribute("address1_composite_compositionLinkControl_address1_line3_d").setValue(null);
Xrm.Page.getAttribute("address1_composite_compositionLinkControl_address1_city_d").setValue(null);
Xrm.Page.getAttribute("address1_composite_compositionLinkControl_address1_stateorprovince_d").setValue(null);
}
}