Initialization hooks perform complex initialization at the beginning of an action. For example, you can use this hook to reset fields or to assign different values to fields based on the type of action.
The following code is a hook that runs when a user attempts to reassign a defect to another user. The hook clears the contents of the action_reason field at the beginning of a reassign action. If the behavior of this field is set to Mandatory, the user must provide a reason for reassigning the defect.
Sub swbug_Initialization(actionname, actiontype) ' actionname As String ' actiontype As Long ' action = reassign ' Vider la zone au début de l'action SetFieldValue "motif_action", "" End Sub
sub swsub_Initialization { my($actionname, $actiontype) = @_; # $actionname : scalaire de chaîne # $actiontype : scalaire long # action : réaffectationis reassign # configurer cette action ici # vider la chaîne au début de l'action $entity->SetFieldValue("action_reason", ""); }