Require national identifier for specific relationship type and
age. |
/* eslint-disable dot-notation */
define([], () => {
'use strict';
function isOlderThanSixMonths(dob) {
const currentDate = new Date();
const birthDate = new Date(dob);
// Calculate the difference in months
const monthDiff = currentDate.getMonth() - birthDate.getMonth() +
(12 * (currentDate.getFullYear() - birthDate.getFullYear()));
// Check if the age is greater than or equal to 6 months
const isOlderThanSixMonths = monthDiff > 6 || (monthDiff === 6 && currentDate.getDate() >= birthDate.getDate());
return isOlderThanSixMonths;
}
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
let dob = $fields['contactRelationships']['dateOfBirth'].$value();
let nidCountry = $fields['personNationalIdentifiers']['LegislationCode'].$value();
if ( dob && isOlderThanSixMonths(dob) && (nidCountry == null || nidCountry == "")) {
return true;
}
return false;
}
return { runCondition };
});
|
Require national identifier for specific relationship type. |
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
if (($fields['contactRelationships']['ContactType'].$value() == 'S' || $fields['contactRelationships']['ContactType'].$value() == 'DP' || $fields['contactRelationships']['ContactType'].$value() == 'P') && ($fields['personNationalIdentifiers']['LegislationCode'].$value() == '' || $fields['personNationalIdentifiers']['LegislationCode'].$value() == null)) {
return true;
}
return false;
}
return { runCondition };
});
|
Require date of birth for specific relationship types. |
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
if (($fields['contactRelationships']['ContactType'].$value() == 'S' || $fields['contactRelationships']['ContactType'].$value() == 'DP' || $fields['contactRelationships']['ContactType'].$value() == 'C') && ($fields['contactRelationships']['dateOfBirth'].$value() == '' || $fields['contactRelationships']['dateOfBirth'].$value() == null)) {
return true;
}
return false;
}
return { runCondition };
});
|
Require home address for specific relationship types. |
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
if (($fields['contactRelationships']['ContactType'].$value() == 'S' || $fields['contactRelationships']['ContactType'].$value() == 'DP' || $fields['contactRelationships']['ContactType'].$value() == 'C') && ($fields['personAddress']['AddressLine1'].$value() == '' || $fields['personAddress']['AddressLine1'].$value() == null)) {
return true;
}
return false;
}
return { runCondition };
});
|
Require phone number for contacts marked as emergency
contact. |
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
if (($fields['contactRelationships']['EmergencyContactFlag'].$value() == true) && ($fields['personPhones']['LegislationCode'].$value() == '' || $fields['personPhones']['LegislationCode'].$value() == null)) {
return true;
}
return false;
}
return { runCondition };
});
|
Require gender and date of birth for a specific legislation and only
for benefit eligible contacts. |
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
if(($objectContext.LegislationCode.includes('US'))){
if (($fields['contactRelationships']['dateOfBirth'].$value() === null || $fields['contactRelationships']['gender'].$value() === null) && $fields['contactRelationships']['ContactTypeMeaning'].$value() === 'Spouse') {
return true;
}
}
return false;
}
return { runCondition };
});
|