Introduction to Event Rules

Event Rules are based on a simple premise: an event occurs that triggers an action. In the EFT administration interface or with the COM API, you specify Actions to occur when an Event takes place. You can also specify one or more Conditions that must exist before an Action is taken or that change the Action that is taken.

For example, suppose you have a folder into which remote partners can drop files. In EFT, you can set up an Event Rule that monitors that folder, and when someone puts a file into that folder, EFT can encrypt that file, move it into another folder, and then send emails to anyone you specify informing them that a file has been moved. You can also set up a Rule that only moves certain files. For example, you can configure the Rule to move only the files with "Important" in the name, or you can route certain files to different folders.

Two administrators can work on Event Rules at the same time, but if they are working on the same Rule at the same time, when one administrator saves a Rule, when the other administrator clicks Apply, he will get a message saying that the changes could not be saved because changes have been made by someone else. The administrator who receives that message will have to refresh (View > Refresh or press F5) to see the other changes, and then make any changes to the Rule again.

Sample Logic

You can easily create complex programmatic Event Rules in EFT's administration interface. The Event Rule system contains objects that you click to add to the Rule builder, and then you click within the Rule to modify parameters and add variables. Below are some examples of logic you can create (in pseudo code). Refer to Events (Triggers) and Examples for examples of creating these rules in the Rule Builder.

(In the examples below, "ON FILE UPLOAD" is the Event trigger; the "if" statements are Event Rule Conditions; "PGP" and "MOVE" are Event Rule Actions.)

Always run an Action if an Event occurs:

ON FILE UPLOAD
{
      PGP Encrypt %FS.PATH%
}
Conditionally run an Action if an Event occurs (IF-THEN statement):
ON FILE UPLOAD
{
    if ( %FS.FILE_NAME% = "*.pgp" )
   {
      PGP Decrypt %FS.PATH%
   }
}

Multiple IF-THEN statements (if something, do this; if something else, do that):

ON FILE UPLOAD
{
  if ( %FS.FILE_NAME% = "*.pgp" )
  {
    PGP Decrypt %FS.PATH%
  }
  if ( %FS.FILE_NAME% = "*.zip" )
  {
    MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATESTAMP%_%EVENT.TIMESTAMP%\"
  }
}

Else statements (if preceding Condition is not met, do something):

ON FILE UPLOAD
{
  if ( %FS.FILE_NAME% = "*.pgp" )
  {
   PGP Decrypt %FS.PATH%
  }
  else
  {
   MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATESTAMP%_%EVENT.TIMESTAMP%\"
  }
}

Run always Action (Action that will always run when the Event occurs even if preceding IF-THEN-ELSE statements are true):

ON FILE UPLOAD
{
 if ( %FS.FILE_NAME% = "*.pgp" )
 {
  PGP Decrypt %FS.PATH%
 }
 else
 {
  MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATESTAMP%_%EVENT.TIMESTAMP%\"
 }
 MOVE "%FS.PATH%\%EVENT.DATESTAMP%_%EVENT.TIMESTAMP%\*.*" 
    to https://somehost/%USER.LOGON%/
 SEND NOTIFICATION email TO %user.email%
}

Run the same Action more than once:

ON FILE UPLOAD
{
 SEND NOTIFICATION email TO serveradministrator@globalscape.com
 SEND NOTIFICATION email TO %user.email%
}

Create compound conditional statements supporting AND and OR logical operators:

ON FILE UPLOAD
{
 if ( %FS.FILE_NAME% = "*.pgp" ) || ( %FS.FILE_NAME% = "*.encrypted" )
 {
  PGP Decrypt %FS.PATH%
 }
 else
 MOVE %FS.PATH% to "%FS.PATH%\%EVENT.DATESTAMP%_%EVENT.TIMESTAMP%\"
 SEND NOTIFICATION email TO %user.email%
}

It is possible to configure Event Rules that create infinitely recursive cycles. A file upload Event cannot be completed until all corresponding Event Actions are finished. This could lead to unpredictable server behavior due to conflicts with shared access to the same files or deleting open files. Be careful not to create circumstances where such recursive cycles might occur. For file upload Events, recursive cycles are not typical. It is recommended that you move files on the same server using the file system, not FTP.