새 기록의 sys_id 소스에서 대상 인스턴스로 복사하는 onBefore 변환 맵 스크립트를 하나 만듭니다. 고유 값은 같지만 sys_id 값이 다른 대상 인스턴스에서 기록을 식별하는 두 번째 onBefore 변환 맵 스크립트를 만듭니다.
프로시저
-
생성한 테이블 변환 맵 기록을 엽니다.
-
변환 스크립트 관련 목록에서 새로 만들기를 클릭합니다.
-
시기 필드에서 onBefore를 선택합니다.
-
다음 스크립트를 입력합니다.
if (action == "insert") {target.setNewGuidValue(source.u_sys_id); }
-
제출을 클릭합니다.
-
변환 스크립트 관련 목록에서 새로 만들기를 클릭합니다.
-
시기 필드에서 onBefore를 선택합니다.
-
다음 스크립트를 입력합니다.
/**
* This script queries for a uniquely identifying value of the referenced record and then
* updates the target reference field with the sys_id of the matching target record.
* This sample assumes:
* 1) The target table contains an assigned_to field which is a reference field.
* 2) The reference field references the User [sys_user] table.
* 3) You can use the email field to uniquely identify users. Alternatively you
* could use the user_name field.
*/
var ref = new GlideRecord("sys_user"); //Replace sys_user with any reference table
ref.addQuery("email", source.email); //Replace email with any unique field
ref.query();
if(ref.next()){
target.assigned_to = ref.sys_id; //Replace assigned_to with any reference field
}
-
제출을 클릭합니다.