diff --git a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js index 8c7da5082acc681e4c7485ce9d9ddec3ec3a87d2..45379fef45e865cc1b5db3b8ff3a663b1d24deb4 100644 --- a/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Organisation_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -10,48 +10,53 @@ let targetEntity = "Organisation_entity"; let valuesToCheck = {}; var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, targetEntity); - //Read the values of all available entity fields and write the fieldname7value combination - //as key/value pairs into an object. This is used to trigger the scan for duplicates - -vars.get("$field.STANDARD_CITY"); -vars.get("$field.STANDARD_ZIP"); -vars.get("$field.STANDARD_ADDRESS"); - -let field = ''; -let fieldValue = ''; -for (fieldname in entityFieldsToLoad) -{ - field = entityFieldsToLoad[fieldname]; - fieldValue = vars.get("$field." + field); - - if(fieldValue != null && fieldValue != "") - { - valuesToCheck[field] = fieldValue; - } -} - -let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, -valuesToCheck, null); - -let duplicateIds = []; - -if(scanResults != undefined && scanResults != null) -{ - //Run thru every duplicate result and read out the id. - //Do it now to have a simple array on all usages lateron. - for (let i = 0; i < scanResults.length; i++) - { - let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; - duplicateIds.push(duplicateContactId); - } -} - -/* - * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the - * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. - * Because of its invalidity, no records are shown. -*/ -if(duplicateIds.length == 0) +if(entityFieldsToLoad == null || entityFieldsToLoad.length == 0) result.string(JSON.stringify(["nodata"])); else - result.string(JSON.stringify(duplicateIds)); \ No newline at end of file +{ + //Read the values of all available entity fields and write the fieldname7value combination + //as key/value pairs into an object. This is used to trigger the scan for duplicates + + vars.get("$field.STANDARD_CITY"); + vars.get("$field.STANDARD_ZIP"); + vars.get("$field.STANDARD_ADDRESS"); + + let field = ''; + let fieldValue = ''; + for (fieldname in entityFieldsToLoad) + { + field = entityFieldsToLoad[fieldname]; + fieldValue = vars.get("$field." + field); + + if(fieldValue != null && fieldValue != "") + { + valuesToCheck[field] = fieldValue; + } + } + + let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, + valuesToCheck, null); + + let duplicateIds = []; + + if(scanResults != undefined && scanResults != null) + { + //Run thru every duplicate result and read out the id. + //Do it now to have a simple array on all usages lateron. + for (let i = 0; i < scanResults.length; i++) + { + let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; + duplicateIds.push(duplicateContactId); + } + } + + /* + * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the + * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. + * Because of its invalidity, no records are shown. + */ + if(duplicateIds.length == 0) + result.string(JSON.stringify(["nodata"])); + else + result.string(JSON.stringify(duplicateIds)); +} \ No newline at end of file diff --git a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js index 091706c58d5674902ad37609f85fac87e8fee3ae..4d8165c1e4ee69cc7a8413033367852782198868 100644 --- a/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js +++ b/entity/Person_entity/entityfields/selfduplicatesuncached/children/onlyshowcontactids_param/valueProcess.js @@ -10,51 +10,57 @@ let targetEntity = "Person_entity"; let valuesToCheck = {}; var entityFieldsToLoad = DuplicateScannerUtils.GetEntityFieldsFromConfig(scannerName, targetEntity); - //Read the values of all available entity fields and write the fieldname7value combination - //as key/value pairs into an object. This is used to trigger the scan for duplicates - -vars.get("$field.STANDARD_CITY"); -vars.get("$field.STANDARD_ZIP"); -vars.get("$field.STANDARD_ADDRESS"); -vars.get("$field.FIRSTNAME"); -vars.get("$field.LASTNAME"); - - -let field = ''; -let fieldValue = ''; -for (fieldname in entityFieldsToLoad) -{ - field = entityFieldsToLoad[fieldname]; - fieldValue = vars.get("$field." + field); - - if(fieldValue != null && fieldValue != "") - { - valuesToCheck[field] = fieldValue; - } -} +if(entityFieldsToLoad == null || entityFieldsToLoad.length == 0) + result.string(JSON.stringify(["nodata"])); +else +{ + //Read the values of all available entity fields and write the fieldname7value combination + //as key/value pairs into an object. This is used to trigger the scan for duplicates -let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, -valuesToCheck, null); + vars.get("$field.STANDARD_CITY"); + vars.get("$field.STANDARD_ZIP"); + vars.get("$field.STANDARD_ADDRESS"); + vars.get("$field.FIRSTNAME"); + vars.get("$field.LASTNAME"); -let duplicateIds = []; -if(scanResults != undefined && scanResults != null) -{ - //Run thru every duplicate result and read out the id. - //Do it now to have a simple array on all usages lateron. - for (let i = 0; i < scanResults.length; i++) - { - let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; - duplicateIds.push(duplicateContactId); - } + let field = ''; + let fieldValue = ''; + for (fieldname in entityFieldsToLoad) + { + field = entityFieldsToLoad[fieldname]; + fieldValue = vars.get("$field." + field); + + if(fieldValue != null && fieldValue != "") + { + valuesToCheck[field] = fieldValue; + } + } + + let scanResults = DuplicateScannerUtils.ScanForDuplicates(scannerName, targetEntity, + valuesToCheck, null); + + let duplicateIds = []; + + if(scanResults != undefined && scanResults != null) + { + //Run thru every duplicate result and read out the id. + //Do it now to have a simple array on all usages lateron. + for (let i = 0; i < scanResults.length; i++) + { + let duplicateContactId = scanResults[i][indexsearch.FIELD_ID]; + duplicateIds.push(duplicateContactId); + } + } + + /* + * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the + * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. + * Because of its invalidity, no records are shown. + */ + if(duplicateIds.length == 0) + result.string(JSON.stringify(["nodata"])); + else + result.string(JSON.stringify(duplicateIds)); } -/* - * To achieve that if there are no duplicates, no contacts should be shown and therefore returned by the - * recordcontainer, an invalid id gets returned. It then is used in the conditionProcess to load the duplicates. - * Because of its invalidity, no records are shown. -*/ -if(duplicateIds.length == 0) - result.string(JSON.stringify(["nodata"])); -else - result.string(JSON.stringify(duplicateIds)); \ No newline at end of file