Overview:
Entry Trigger: This function is executed each time a flowitem enters this object.
Exit Trigger: This function is executed each time a flowitem exits this object.
Note on entry/exit trigger context: Generally, the entry and exit triggers are executed at the very beginning of the OnReceive/OnSend event of an object, before any other logic is executed. This means that you can change the object's variables, labels, etc., and have those changes be applied correctly within the event logic. However, executing commands that may affect further events of the object should not be executed in the entry/exit trigger, because some events have yet to be created in the event logic of the object, and functions which affect the object's events should wait until those events have been created. In such a case you should send the object a delayed message in 0 time (using the senddelayedmessage() command), and then execute the functionality from the message trigger. This allows the object to finish the rest of its event logic before your commands are executed. Commands which apply in this setting are stopobject(), requestoperators(), openoutput(), openinput(), resumeinput(), resumeoutput(), and in some cases the creating and dispatching of task sequences, depending on the types of tasks that are in them.
Access variables:
current: the current object
item: the involved object that just entered/exited
port: the number of the port that the object came/left through