diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index a4a627f938fcc725b882048305852824282789ad..446f310d7bc96179cfbcae4721156500e1110b61 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -60,6 +60,7 @@ <name>SALUTATION</name> <title>Salutation</title> <consumer>Salutations</consumer> + <mandatory v="true" /> </entityField> <entityField> <name>TITLE</name> diff --git a/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js b/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js index c5a419766d570f6091355c47f0362d476d2a4c71..612c7e81d16e51455c5f693c1f4a58579a2b0548 100644 --- a/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js +++ b/entity/QuickEntry_entity/entityfields/person_salutation/mandatoryProcess.js @@ -2,9 +2,14 @@ import("system.logging"); import("system.result"); import("system.vars"); -var insertedRows = vars.get("$field.Adresses.insertedRows"); -var isInserted = insertedRows.some(function (row){ - return row["ZIP"] || row["CITY"] || row["ADDRESS"]; -}) +var isMandatory = false; +if (vars.get("$field.LASTNAME") != "") + isMandatory = true; +else { + var insertedRows = vars.get("$field.Adresses.insertedRows");//this is the list of person contact addresses + isMandatory = insertedRows.some(function (row){ + return row["ZIP"] || row["CITY"] || row["ADDRESS"]; + }); +} -result.string(isInserted); \ No newline at end of file +result.string(isMandatory); \ No newline at end of file