유효성 검사 스크립트 구성
DataImportValidationConfig 스크립트 포함을 사용하여 준비 테이블에 대한 확인 규칙을 구성합니다.
시작하기 전에
필요한 역할: sn_customerservice.customer_admin
이 태스크 정보
준비 테이블에 대한 필드 및 기록 수준 확인 규칙을 정의합니다. 이러한 확인 규칙은 데이터를 스테이징 테이블로 임포트한 후 에이전트가 확인 버튼을 선택할 때 트리거됩니다. 자세한 내용은 Playbook으로 계정 수명주기 이벤트 데이터 임포트 문서를 참조하십시오.
프로시저
- 다음으로 이동 모두 > 관리자 > 스크립트 포함레이블이 표시됩니다.
-
계정 수명 주기 이벤트 애플리케이션을 검색하고
DataImportValidationConfig스크립트 포함을 선택합니다.기본 시스템과 함께 제공되는 기본 테이블에 대해 정의된 확인 규칙을 볼 수 있습니다. -
다음과 같은 세 가지 유형의 유효성 검사 규칙을 정의할 수 있습니다.
- 필수 필드: 스테이징 테이블에 있어야 하는 필수 필드를 지정합니다.
예: "sn_acct_lc_account_onb_import_contacts 테이블에서 다음 필드를 필수로 지정할 수 있습니다.
'u_account', 'u_email', 'u_last_name' - 참조 필드: 스테이징 테이블에서 참조 필드를 지정합니다. 참조 필드에는 다른 테이블의 필드에 대한 참조가 저장됩니다. 참조 필드를 정의하면 두 테이블 간에 관계가 생성됩니다.예:여기서
sn_acct_lc_account_onb_import_contacts테이블의 경우 다음과 같이 참조 필드 확인을 정의할 수 있습니다."sn_acct_lc_account_onb_import_contacts": { 'u_account': { 'table_name': 'customer_account', 'reference_field': 'name' }u_account은 스테이징 테이블에 있는 필드의 이름이고,customer_account는 테이블이며,이름은연결된 참조 필드입니다. - 사용자 지정 확인: 준비 중인 테이블 기록의 유효성을 검사하는 사용자 지정 스크립트를 정의합니다. 다음은 사용자 지정 확인 스크립트의 예입니다.
dataImportCustomValidationForCustomerContacts: function(stagingTableGr){ try{ if(this.debuggingEnabled) this.logs.push('Inside dataImportCustomValidationForCustomerContacts'); //Check the Account field's value coming from Excel is matching the corresponding Task or not. while(stagingTableGr.next()){ if (global.JSUtil.notNil(stagingTableGr.task) && global.JSUtil.notNil(stagingTableGr.u_account)){ if (stagingTableGr.task.company.name != stagingTableGr.u_account){ sn_acct_lc.DataImportValidationFunctions.updateStagingTableRecordValidationComments(stagingTableGr, false, 'The Account is not matching with the Case Account.'); } } } } catch (err){ gs.error('Error while executing - dataImportCustomValidationForCustomerContacts - '+err); if(this.debuggingEnabled) this.logs.push('Error while executing - dataImportCustomValidationForCustomerContacts - '+err); //Update the Validation Comments with the Error sn_acct_lc.DataImportValidationFunctions.updateStagingTableRecordValidationComments(stagingTableGr, false, gs.getMessage('sn_acct_lc.DataImportValidationUtil.ValidationFailed', 'Custom')); } },앞의 예제에서
dataImportCustomValidationForCustomerContacts는 사용자 지정 유효성 검사 스크립트입니다. 이 함수는 스테이징 테이블에 업로드된 모든 기록이 포함된stagingTableGr변수(GlideRecord 변수)를 호출합니다. 스크립트는DataImportValidationFunctions를 사용하여 지정된 조건을 확인하고 데이터의 유효성을 검사합니다.
앞의 예에 표시된 형식으로 새 스테이징 테이블에 대해 하나 이상의 스크립트를 정의할 수 있습니다.
- 필수 필드: 스테이징 테이블에 있어야 하는 필수 필드를 지정합니다.
- 업데이트를 선택하여 스크립트 포함에 대한 변경 내용을 저장합니다.