機械翻訳について

福利厚生連絡先ページに検証ルールを追加するにはどうすればよいですか。

その方法は次のとおりです。

  1. 「自分」「福利厚生」「登録する前に」にナビゲートします。 検証ルールをサポートする他のページも使用できます。
  2. グローバル・ヘッダーの「設定およびアクション」メニューで、「Visual Builder Studioでのページの編集」をクリックします。 このオプションを表示するには、VB Studio構成に適切なアクセス権があることを確認します。
  3. [フィールド値の検証]ボタンをクリックします。
  4. まだ検証を作成していない場合は、「検証」をクリックします
  5. ラベルを追加して、「作成」をクリックします
  6. 「条件」リージョンで「編集」をクリックします。
  7. 検証ルールの条件を作成します。
  8. 「完了」をクリックします。
  9. メッセージの要約、重大度および詳細を追加します。
  10. 拡張検証ルールの使用方法を次に示します。
    1. 「拡張条件の使用」ボタンをクリックします。
    2. 「コード」ボタンをクリックします。
    3. Javaスクリプト・コードを追加します。
  11. 変更を保存します。
  12. 変更をプレビューおよび公開します。

すべての福利厚生連絡先ページでは、これらの拡張検証ルールがサポートされます。

福利厚生連絡先ページでサポートされている検証ルール

検証ルール サンプルJavaスクリプト
特定の関係タイプおよび年齢に対して国別識別子が必要。
/* 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 };
});
特定の関係タイプに対して国別識別子が必要。
/* 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 };
});

特定の関係タイプに対して生年月日が必要。
/* 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 };
});
特定の関係タイプに対して自宅住所が必要。
/* 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 };
});
緊急連絡先としてマークされた連絡先に対して電話番号が必要。
/* 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 };
});
特定の国別仕様および福利厚生適格連絡先に対してのみ、性別および生年月日が必要。
/* 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 };
});