Documentation

Execute

public int 
CBPActivity::Execute( void )

This method is called by the runtime during execution of an activity. It directly realizes the behaviour of activity and shall be re-defined for each activity. Method Execute can contain an arbitrary code. By default this method does nothing.

Method "Execute" shall return status for activity completion. This status is used by the runtime, to define if the completion of activity was successful, or if it still ongoing, or has one of the other possible statuses, which can describe to runtime, how things are going with this activity. Possible values of the activity completion statuses are described in the CBPActivityExecutionStatus class:

  • CBPActivityExecutionStatus::Closed - activity has completed its operation and can be closed;
  • CBPActivityExecutionStatus::Executing - the activity still has the work that needs to be additionally completed. For example, composite action shall complete its descendant elements. In this case, the composite activity can plan the launch of its each descendant activity and await until their work is completed prior than informing the runtime that this activity has been completed.
You can subscribe to the modification of activity completion status. For example, composite activity can find out about completion of the descendant activity within it via subscription to modifications of its status in CBPActivityExecutionStatus::Closed.

Examples

<?
public function Execute()
{
$this->WriteToTrackingService(“Test record: ”. $this->MyProperty);
. . .
return CBPActivityExecutionStatus::Closed;
}
?>


© «Bitrix24», 2001-2024
Up