Rule actions

Rule actions define what to do when the if part of the rule is true or false.

You define actions in the then and else parts of a rule. A rule action consists of at least one action phrase that the rule executes when the if part of the rule is true. It can also contain action phrases to execute when the if part of the rule is false.

You define actions in the following parts of a rule:

  • then: This part defines actions that the rule executes when the if part of the rule is true or when no if part exists. When there is no if part, the then keyword becomes optional.
  • else: This optional part defines actions that are executed when the if part of the rule is false. You do not have to declare an else part for a rule.

The then part of a rule must define at least one action. If the then or else part contains multiple actions, the rule executes the actions in their listed order.

Action phrases must pick a value for the decision to make. The decision is either represented by the decision keyword, or by the name of the output of the decision.

Example of the then part

if 
	the value of 'shopping cart' is more than $100 
then 
	set discount to 15; 

Example of the else part

The following rule applies a change when the conditions are met (then), or a different change when the conditions are not met (else):

if 
	'loan report' is approved 
	and the loan grade of 'loan report' is one of { "A", "B", "C" } 
then 
	set decision to a new loan report status where the message is "Congratulations! Your loan has been approved"; 
else 
	set decision to a new loan report status where the message is "Congratulations! Your loan has been approved";