Accessing the name of the currently executed rule in an action part

You can use a predefined variable to access the name of the currently executed rule in the actions part of an action rule.

You can access the name of the currently executed rule in the actions part of an action rule using a predefined variable. The variable is of type String and contains the name of this rule.

Note: You do not need to enclose this variable in quotation marks.

This variable is not available in either the definitions or conditions part of the rule. At runtime, this variable is assigned the business name of the rule being executed.

Here is an example illustrating the use of this variable:

if 
	the age of the customer is less than 18 
then 
	print the message "A 5% discount has been applied to policy: " + the name of this rule; 

References to this predefined variable are translated into ilog.rules.brl.IlrNameUtil.getBusinessIdentifier(?instance.ruleName).

rule Young_Customer_Policy { 
property status = "new"; 
when { 
      customer balsample.Customer(); 
      evaluate (customer.age < 18); 
} 
then { 
      balsample.Customer.printMessage(
      ("A 5% discount has been applied to policy: " + 
      ilog.rules.brl.IlrNameUtil.getBusinessIdentifier(?instance.ruleName))
      ); 
} 
}