초기화 후크는 조치 시작 시 복잡한 초기화를 수행합니다. 예를 들어, 이 후크를 사용하여 필드를 재설정하거나 조치의 유형을 기반으로 필드에 다른 값을 지정할 수 있습니다.
다음 코드는 사용자가 다른 사용자에게 결함을 재지정하는 경우 실행되는 후크입니다. 후크는 재지정 조치 시작 시 action_reason 필드의 컨텐츠를 지웁니다. 이 필드의 동작이 Mandatory로 설정된 경우 사용자는 결함을 재지정하는 이유를 제공해야 합니다.
Sub swbug_Initialization(actionname, actiontype)
' actionname As String
' actiontype As Long
' action = reassign
' Empty the string at the beginning of the action
SetFieldValue "action_reason", ""
End Sub
sub swsub_Initialization {
my($actionname, $actiontype) = @_;
# $actionname as string scalar
# $actiontype as long scalar
# action is reassign
# do any setup for the action here
# Empty the string at the beginning of the action
$entity->SetFieldValue("action_reason", "");
}