diff --git a/entity/AddressValidation_entity/AddressValidation_entity.aod b/entity/AddressValidation_entity/AddressValidation_entity.aod index d3842d9a8ed5c361a9bba21d83e61588dc3b04b0..3d3c7ba01aa0adcfd74ded1cc1e7509dc0cb7754 100644 --- a/entity/AddressValidation_entity/AddressValidation_entity.aod +++ b/entity/AddressValidation_entity/AddressValidation_entity.aod @@ -106,6 +106,12 @@ <fieldName>FullAddressValidation</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>4301c0b9-401f-43af-bd21-8a034aaa7d55</name> + <entityName>QuickEntry_entity</entityName> + <fieldName>AdressValidation</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/QuickEntry_entity/QuickEntry_entity.aod b/entity/QuickEntry_entity/QuickEntry_entity.aod index 3a754cdb58b33ee3c98c2e2e277719f675006c28..57fc14ed258da8732a5d31d33e732639a56fd409 100644 --- a/entity/QuickEntry_entity/QuickEntry_entity.aod +++ b/entity/QuickEntry_entity/QuickEntry_entity.aod @@ -224,6 +224,14 @@ <stateProcess>%aditoprj%/entity/QuickEntry_entity/entityfields/leadquickacquisition/stateProcess.js</stateProcess> <onValueChange>%aditoprj%/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js</onValueChange> </entityField> + <entityConsumer> + <name>AdressValidation</name> + <dependency> + <name>dependency</name> + <entityName>AddressValidation_entity</entityName> + <fieldName>FullAddressValidation</fieldName> + </dependency> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js b/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js index c6d127a51319f7caa58cf93e631722e2deeed63d..70cc939534d8b6e65a08fa7ab7ebb244f4ff9764 100644 --- a/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js +++ b/entity/QuickEntry_entity/entityfields/leadquickacquisition/onValueChange.js @@ -1,6 +1,7 @@ import("system.neon"); import("system.vars"); import("Entity_lib"); +import("system.entities"); import("KeywordRegistry_basic"); import("LeadQuickAcquisition_lib"); @@ -37,9 +38,38 @@ if(vars.get("$local.value")) } else if(response.address) { - neon.addRecord("OrgAddresses", { + var orgAddressPresets = { "AddressSearch" : response.address - }); + }; + + var getRowsConfig = entities.createConfigForLoadingRows() + .entity("AddressValidation_entity") + .provider("FullAddressValidation") + .fields(["CITY", "ZIP", "STREET"]) + .addParameter("CurrentValue_param", "Ritter-von-Schoch-Straße 5, 84036 Landshut"); + + var rows = entities.getRows(getRowsConfig); + + if (rows.length > 0) + { + var affectedRow = rows[0]; + + if (affectedRow["CITY"]) + orgAddressPresets.CITY = affectedRow["CITY"]; + + if (affectedRow["ZIP"]) + { + orgAddressPresets.ZIP = affectedRow["ZIP"]; + } + + if (affectedRow["STREET"]) + { + orgAddressPresets.ADDRESS = affectedRow["STREET"]; + } + + } + + neon.addRecord("OrgAddresses", orgAddressPresets); } if(response.companyName) neon.setFieldValue("$field.ORGANISATION_NAME", response.companyName);