2302 Table Rules
Table Rules: Database-Level Automation
What are Table Rules?
How Table Rules Work
Execution Flow
- A record in the table is created or modified (from any source)
- Tadabase checks for active table rules with matching triggers
- For each matching rule, conditions are evaluated
- If conditions are met (or no conditions exist), actions execute
- The record is saved with all changes applied
Trigger Types
- Record Created - Runs only when a new record is added
- Record Edited - Runs only when an existing record is modified
- Record Created or Edited - Runs on both creation and modification
When to Use Table Rules
Must Always Execute
- Setting default values for new records
- Calculating fields based on other field values
- Enforcing data validation rules
- Maintaining audit trails
- Ensuring data consistency
Applies to All Entry Points
- All web forms
- Mobile app submissions
- API record creation/updates
- Data imports
- Bulk operations
- Record rules that create records in this table
Maintains Data Integrity
- Auto-generate unique identifiers
- Set timestamps for creation/modification
- Calculate derived values
- Enforce business constraints
- Update related records
Creating Table Rules
Step 1: Navigate to the Data Table
Step 2: Define the Trigger
- Record Created - For initialization logic that should only run once
- Record Edited - For updates that should only apply to existing records
- Record Created or Edited - For logic that applies to both new and existing records
Step 3: Specify the Action
- Update This Record - Modify fields in the current record
- Update Connected Records - Update related records in connected tables
- Insert Connected Record - Create a new related record
- Insert New Record - Create a new record in any table
- Send Email - Send an email notification
- Send SMS - Send a text message
Step 4: Add Conditions (Optional)
- Compare field values
- Check if fields are empty or not empty
- Use date comparisons
- Combine multiple conditions with AND/OR logic
No Conditions: If you don't add any conditions, the action will always execute when the trigger fires.
Step 5: Set Field Values
- Custom Value - A static value you define
- Set Blank - Clear the field value
- Form Value - Copy from another field in the record
- Connected Value - Pull from a related record
- Logged-in User Field - Use data from the current user
- Auto Logged User - Set to the currently logged-in user
- Current Date/Time - Set to the current timestamp
Step 6: Save and Test
- Click Save to save your rule
- The rule is enabled by default
- Test by creating or editing a record
- Verify the rule executes as expected
Table Rule Actions in Detail
1. Update This Record
Common Use Cases
- Set default values for new records
- Calculate derived fields
- Set timestamps
- Auto-assign records to users
- Enforce status workflows
Example 1: Set Default Values on Creation
Scenario: When a new lead is created, automatically set the status to "New", priority to "Medium", and date added to the current date.
Configuration:
- Trigger: Record Created
- Action: Update This Record
- Conditions: None (always run)
- Field Values:
- Status → Custom Value: "New"
- Priority → Custom Value: "Medium"
- Date Added → Current Date/Time
Example 2: Calculate Total on Edit
Scenario: When an order is created or edited, calculate the total by multiplying quantity by unit price.
Configuration:
- Trigger: Record Created or Edited
- Action: Update This Record
- Conditions: None
- Field Values:
- Total → Formula: {quantity} * {unit_price}
Note: For calculations, use equation fields or set up the calculation using form values.
Example 3: Status Workflow Enforcement
Scenario: When a support ticket's status changes to "Resolved", automatically set the "Resolved Date" to the current date and "Resolved By" to the logged-in user.
Configuration:
- Trigger: Record Edited
- Action: Update This Record
- Conditions: Status equals "Resolved"
- Field Values:
- Resolved Date → Current Date/Time
- Resolved By → Auto Logged User
2. Update Connected Records
Common Use Cases
- Propagate status changes to related records
- Update parent records when child records change
- Maintain summary fields in parent tables
- Synchronize data across related tables
Example 4: Cascade Status to Tasks
Scenario: When a project's status is set to "Completed", automatically update all connected tasks to "Completed" as well.
Configuration:
- Table: Projects
- Trigger: Record Edited
- Action: Update Connected Records (Tasks)
- Conditions: Status equals "Completed"
- Field Values:
- Task Status → Custom Value: "Completed"
- Completion Date → Current Date/Time
Example 5: Update Parent Record Timestamp
Scenario: When a task is created or modified, update the parent project's "Last Activity" field to the current date.
Configuration:
- Table: Tasks
- Trigger: Record Created or Edited
- Action: Update Connected Records (Project)
- Conditions: None
- Field Values:
- Last Activity → Current Date/Time
3. Insert Connected Record
Common Use Cases
- Create default child records for new parents
- Generate related records based on conditions
- Initialize records with template data
- Create notifications or tasks
Example 6: Create Default Tasks for New Projects
Scenario: When a new project is created, automatically create three default tasks: "Project Kickoff", "Requirements Gathering", and "Initial Planning".
Configuration:
Create three separate rules (or one with multiple actions if supported):
- Rule 1:
- Trigger: Record Created
- Action: Insert Connected Record (Task)
- Conditions: None
- Field Values:
- Task Name → Custom Value: "Project Kickoff"
- Status → Custom Value: "Pending"
- Priority → Custom Value: "High"
- Rule 2: Similar for "Requirements Gathering"
- Rule 3: Similar for "Initial Planning"
Example 7: Create Notification for High-Priority Items
Scenario: When a support ticket is created with "High" or "Critical" priority, create a notification record for the support manager.
Configuration:
- Table: Support Tickets
- Trigger: Record Created
- Action: Insert Connected Record (Notification)
- Conditions: Priority equals "High" OR Priority equals "Critical"
- Field Values:
- Notification Type → Custom Value: "High Priority Ticket"
- Assigned To → Custom Value: "Support Manager"
- Date Created → Current Date/Time
4. Insert New Record
Common Use Cases
- Create audit log entries
- Generate activity history
- Create records in logging tables
- Trigger workflows in other tables
Example 8: Audit Log for Sensitive Records
Scenario: When a customer record is edited, create an audit log entry tracking who made the change and when.
Configuration:
- Table: Customers
- Trigger: Record Edited
- Action: Insert New Record (Audit Log table)
- Conditions: None
- Field Values:
- Action Type → Custom Value: "Customer Modified"
- Modified By → Logged-in User's Name
- Modified Date → Current Date/Time
- Customer Name → Form Value: Customer Name
Important: Use regular fields (not connection fields) in the audit log table to prevent orphaned records if the original record is deleted.
5. Send Email
Common Use Cases
- Notify team members of record changes
- Send alerts for critical conditions
- Welcome emails for new records
- Status change notifications
Example 9: Notify Assignment
Scenario: When a task is assigned to a user, send them an email notification.
Configuration:
- Trigger: Record Created or Edited
- Action: Send Email
- Conditions: Assigned To is not empty
- Email Configuration:
- To: {assigned_to.email}
- Subject: "New Task Assigned: {task_name}"
- Body: "You have been assigned a new task: {task_name}. Due date: {due_date}."
6. Send SMS
Example 10: Urgency Alert
Scenario: When a critical incident is reported, send an SMS alert to the on-call technician.
Configuration:
- Trigger: Record Created
- Action: Send SMS
- Conditions: Priority equals "Critical"
- SMS Configuration:
- To: {on_call_tech.phone}
- Message: "CRITICAL INCIDENT: {incident_title}. Location: {location}."
Working with Conditions
Single Conditions
- Status equals "Approved"
- Total is greater than 1000
- Date Created is during the last 7 days
Multiple Conditions (AND Logic)
- Status equals "Pending" AND Amount is greater than $5,000
- Priority equals "High" AND Assigned To is not empty
- Date Created is before 30 days ago AND Status is not "Completed"
Multiple Conditions (OR Logic)
- Priority equals "High" OR Priority equals "Critical"
- Status equals "Overdue" OR Days Late is greater than 7
Complex Conditions
- (Status equals "Active" AND Balance is greater than 0) OR (Payment Date is before 30 days ago)
Field Value Options
Custom Value
- Status → "Approved"
- Priority → "Medium"
- Discount Percentage → 10
Set Blank
- Clear "Assigned To" when status becomes "Completed"
- Remove "Temporary Note" after processing
Form Value
- Billing Address → Copy from Shipping Address
- Final Price → Copy from Quote Price
- Contact Email → Copy from Primary Email
Connected Value
- Task's Priority → Copy from connected Project's Priority
- Order's Customer Email → Pull from connected Customer's Email
- Invoice's Billing Address → Pull from connected Customer's Address
Logged-in User Field
- Created By Name → Logged-in User's Name
- Department → Logged-in User's Department
- Employee ID → Logged-in User's Employee ID
Auto Logged User
- Assigned To → Auto Logged User
- Created By → Auto Logged User
Current Date/Time
- Date Created → Current Date/Time
- Last Modified → Current Date/Time
- Timestamp → Current Date/Time
Timezone Note: The current date/time uses your app's timezone setting. Ensure it's configured correctly in App Settings.
Best Practices for Table Rules
1. Use Descriptive Names
- Good: "Set Default Status and Date on Lead Creation"
- Bad: "Rule 1"
2. Choose the Right Trigger
- Use "Record Created" for initialization that should only run once
- Use "Record Edited" for updates to existing records
- Use "Record Created or Edited" when logic applies to both scenarios
3. Add Conditions to Prevent Unnecessary Execution
- Only send emails if email field is not empty
- Only update status if it has changed
- Only create related records if they don't already exist
4. Avoid Circular Logic
- Table A rule updates Table B
- Table B rule updates Table A
- Results in infinite loop
Prevention: Use specific conditions to break the loop, or use "Record Created" instead of "Record Created or Edited".
5. Test Thoroughly
- Create test records to verify the rule works
- Test with different data scenarios
- Verify conditions filter correctly
- Check that all actions execute as expected
- Test with API and imports if applicable
6. Organize with Folders
- Group related rules in folders
- Use consistent naming conventions
- Keep active and inactive rules separate
7. Document Complex Rules
- Explain what the rule does
- Note any dependencies
- Document special conditions
- Include examples
Advanced Table Rule Scenarios
Scenario 1: Multi-Step Approval Workflow
Requirement: Expense reports under $1,000 need manager approval. Over $1,000 need both manager and director approval.
Solution: Create multiple table rules:
- Rule 1: Set approval level on creation
- Trigger: Record Created
- Condition: Amount is less than or equal to $1,000
- Action: Update This Record → Approval Required = "Manager"
- Rule 2: Set higher approval level
- Trigger: Record Created
- Condition: Amount is greater than $1,000
- Action: Update This Record → Approval Required = "Manager and Director"
- Rule 3: Notify manager when submitted
- Trigger: Record Edited
- Condition: Status equals "Submitted for Approval"
- Action: Send Email to Manager
Scenario 2: Maintaining Summary Fields
Requirement: Keep a running total of all order amounts in the customer record.
Solution: Use equation fields or update connected records:
- On Orders table:
- Trigger: Record Created or Edited
- Action: Update Connected Records (Customer)
- Condition: None
- Field Values: Last Order Date → Current Date/Time
- Use equation field in Customer table: Sum of all connected order totals
Scenario 3: Data Validation and Cleanup
Requirement: Ensure phone numbers are formatted consistently and email addresses are lowercase.
Solution: Create rules to clean data:
- Rule 1: Standardize phone format
- Trigger: Record Created or Edited
- Condition: Phone is not empty
- Action: Update This Record
- Note: Use validation rules or pipes for formatting
- Rule 2: Lowercase emails
- Trigger: Record Created or Edited
- Condition: Email is not empty
- Action: Update This Record
- Field Values: Email → Use pipes to convert to lowercase
Troubleshooting Table Rules
Rule Not Executing
- Is the rule enabled? (toggle switch)
- Does the trigger match your action? (creating vs editing)
- Do the conditions match your test data?
- Are field names spelled correctly?
Wrong Values Set
- Are you using the correct value type? (Custom vs Form vs Connected)
- Are field mappings correct?
- Is the source field populated?
- Are multiple rules overwriting each other?
Emails Not Sending
- Is the email field populated?
- Is the email address valid?
- Are conditions preventing the email action?
- Check your plan's email limits
Performance Issues
- Too many rules on one table
- Rules creating circular updates
- Complex conditions taking too long to evaluate
- Updating many connected records at once
Managing Table Rules
Enabling/Disabling Rules
- Click the toggle switch on the rule
- Useful for testing or temporarily pausing automation
- Disabled rules are preserved and can be re-enabled anytime
Editing Rules
- Click on the rule name to open the editor
- Make changes to trigger, conditions, or actions
- Save changes
- Test to verify the changes work as expected
Deleting Rules
- Click the delete icon on the rule
- Confirm deletion
- The rule is permanently removed
Warning: Deleting rules cannot be undone. Consider disabling instead if you might need the rule again.
Hands-On Exercise
Setup
- Create two tables: Customers and Orders
- Add a connection field in Orders connecting to Customers
- Add fields in Orders: Order Number, Order Date, Status, Total, Customer (connection)
- Add fields in Customers: Name, Email, Total Orders, Last Order Date
Rules to Create
Orders Table Rules
- Auto-generate Order Number
- Trigger: Record Created
- Action: Update This Record
- Field: Order Number → Use equation or auto-number field
- Set Order Date
- Trigger: Record Created
- Action: Update This Record
- Field: Order Date → Current Date/Time
- Set Default Status
- Trigger: Record Created
- Action: Update This Record
- Field: Status → Custom Value: "Pending"
- Update Customer Last Order Date
- Trigger: Record Created
- Action: Update Connected Records (Customer)
- Field: Last Order Date → Current Date/Time
- Send Order Confirmation Email
- Trigger: Record Created
- Action: Send Email
- To: {customer.email}
- Subject: "Order Confirmation: {order_number}"
- Body: Order details
Test Your Rules
- Create a new order and verify:
- Order number is generated
- Order date is set to current date
- Status is "Pending"
- Customer's last order date is updated
- Confirmation email is sent
Summary
- They run at the database level for all data entry methods
- Use them for core business logic and data integrity
- Choose the right trigger: Created, Edited, or Both
- Add conditions to control when actions execute
- Test thoroughly before deploying to production
- Document complex rules for maintainability
We'd love to hear your feedback.