Docs‎ > ‎Reactive Logic Tutorial‎ > ‎

Validation (Place new order)

This page explores the solution to the Behavior: Check Credit.


Using the process described on the Rules page, we will solve:

 Step  In the example  Notes
 Epic  Order Processing  
 User Story  Place Order  
 Behavior  Check Credit  Ensure that the balance does not exceed the credit limit



The relevant Domain Objects:

How to Run

To explore Place Order:
  1. Use Sample
  2. Navigate to the REST Lab
  3. Select Resource > PartnerOrder
  4. Post the json below (cut and paste in Request Body)
Request Body

    "is_ready": false,
    "approving_officer": "G PO.1",
    "salesrep_name": "A. Lincoln",
    "customer_name": "Gloria's Garden",
    "LineItems": [
     {   "product_name": "Hammer",
"quantity_ordered": 1

Press POST


Next, you define one or more rules that solve the identified behavior, Check Credit. The logic triggered by each LineItems insertion is summarized as follows:

 Object Watches for Reacts by Which chains to
 LineItems.amount inserts, deletes or changes to quantity or partPrice Computes amount Orders.amount_un_paid
 Orders.amount_un_paid attribute amount adjusts amount_un_paid  Customer.balance
 Customer.balance amount_un_paid adjusts balance Validation checkCredit
 Validation checkCredit balance accept or reject transaction 

Concepts Illustrated

This illustrates the most common Business Logic Pattern: Constraining a Derived Result.

It also illustrates the Replicate Junction Pattern.