입력 작업에 대한 설명 유형 및 업데이트에 대한 스크립트 코드
다음 스크립트를 사용하여 입력 양식에 입력한 사용자 설명이 저장되는 위치를 결정합니다. 또한 이 스크립트는 주석 삭제, 업데이트, 새 텍스트 삽입 및 변경 타임스탬프 추적을 기록합니다.
이 코드는 특정 입력에 대한 매개변수 작업을 처리하는 함수를 WriteBackAction 정의합니다. input1에 대한 매개변수 작업을 검색하고 이를 반복하여 주석을 처리합니다. 코멘트가 삭제됨으로 표시된 경우 관리자는 코멘트 삭제를 처리하는 논리를 설정할 수 있습니다. 설명이 삭제된 것으로 표시되지 않은 경우 설명 값과 마지막으로 업데이트된 타임스탬프를 검색하고 특정 기록에 대한 결과 테이블에서 설명을 추가하거나 업데이트합니다.
(function WriteBackAction(parm_input, parm_variable, actionResult, additionalData) {
var additionalInputDataMap = additionalData.getAdditionalInputDataMap();
var paramActions = additionalInputDataMap['input1'].getParameterActions(); // input1 stands for the input's name. Could be any input type
for (i = 0; i < paramActions.length; i++) {
var currentAction = paramActions[i];
// Handle Add/Remove/Update Comment
if (currentAction.getType() === 'comment') {
var hasDeleted = currentAction.hasDeleted(); // Checks if the user deleted the comment in the input form's UI
if (hasDeleted && hasDeleted == true) {
// Handle delete logic here, for example set the field where the comment is set to an empty string
}
else
{
var commentValue = currentAction.getCommentValue();
var commentLastUpdatedTimeStamp = currentAction.getLastUpdatedTimestamp();
// handle here add/update comment to the result table for the specific record
}
}
}