Events at Runtime

Print Friendly, PDF & Email

◷ Reading Time: 3 minutes


FlexRule Runtime is event driven. That means you can capture details of what is happening during rules execution. Namespace FlexRule.Events has all related types for this behaviour. There are two ways of capturing the events:

  1. Automatically (Using IRuntimeEngine.EnableFullLog)
  2. Manually (Using FlexRule.Events.RuntimeEvents)


Here is the list of events that can be captured:

NameWhen is raised?
CriteriaEvaluatedlogic of a rule is evaluated
RanActionsActions of a rule are executed because the criteria are met
RanAlternateActionsActions of a rule are executed because the criteria are not met
ConditionEvaluatedCondition of a rule is evaluated
RunningReferencedLogicReferenced logic of higher level is about to run
CriteriaEvaluatingcriteria of a rule is about to be evaluated



When on RuntimeEngine.EnableFullLog is set to true, it captures all the events for execution. Then RuntimeResult.ConclusionLog can be used to retrieve a generated execution log based on raised events. Below is a sample of conclusionLog:

Document: discount percentage
	R1 (Passed=False): 
	Conditions (Count=1):
		[1] Destination: (Result=false)

	R2 (Passed=True):
	Conditions (Count=3):
		[1] Destination: (Result=true)
		[2] Age: (Result=true)
		[3] Is Firday or Monday: (Result=true)

	R3 (Passed=False):
	Conditions (Count=3):
		[1] Destination: (Result=true)
		[2] Age: (Result=true)
		[3] Is Firday or Monday: (Result=false)

	R4 (Passed=False):
	Conditions (Count=1):
		[1] Destination: (Result=false)

	R5 (Passed=False):
	Conditions (Count=1):
		[1] Destination: (Result=false)

	R6 (Passed=False):
	Conditions (Count=2):
		[1] Destination: (Result=true)
		[2] Age: (Result=false)

	R7 (Passed=False):
	Conditions (Count=2):
		[1] Destination: (Result=true)
		[2] Age: (Result=false)


When you don’t need a full log, and you are just looking for some specific events, then RuntimeEngine.Events can be set manually to any of the events mentioned above. After execution is finished all of the events RuntimeResult.Events will have all the collected execution events:

Custom Build Reports

There might be a need to create custom reports based on specific layouts, and formats etc. This can be done by creating applications and collecting Runtime execution events and finally, putting the events’ information back together as a report to present in the desired format or layout.

FlexRule Runtime provides a FlexRule.Events namespace to manage and access the events. Your application can subscribe to events using RuntimeEvents.Register method, which allows registering for specific events.
The events can be aggregated to create custom reports. Events have semantic relationship as a child-parent relation. To understand and navigate this relationship, out-of-the-box the event aggregation is provided by Report Elements in FlexRule Runtime.

FlexRule Designer

When running rules in FlexRule Designer EnableFullLog is set to true and the result of the conclusion log can be seen in the output window under Debugger Log section.


Have a look at the Airline Discount Program sample.

Updated on October 2, 2019

Was this article helpful?

Related Articles