NowAIKit
Get started
Use cases Pricing Docs Contact Get started
Build

Build Business Rule — example output

Business rule creation with validation

$ nowaikit run build-business-rule
nowaikit run build-business-rule -p ollama -m qwen3.5
███╗ ██╗ ██████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ██╗██╗████████╗ ████╗ ██║██╔═══██╗██║ ██║ ██╔══██╗██║ ██║ ██╔╝██║╚══██╔══╝ ██╔██╗██║██║ ██║██║ █╗ ██║ ███████║██║ █████╔╝ ██║ ██║ ██║╚████║██║ ██║██║███╗██║ ██╔══██║██║ ██╔═██╗ ██║ ██║ ██║ ╚███║╚██████╔╝╚███╔███╔╝ ██║ ██║██║ ██║ ██╗██║ ██║ ╚═╝ ╚══╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ NowAIKit The #1 AI App for ServiceNow - Running build-business-rule in direct mode (ollama)... # ServiceNow Business Rule Analysis Report ## Step 1 — Understand the Requirement **Current Status:** ⚠️ **Requirement Not Provided** I've been tasked with building a business rule for the incident table with a "before" trigger, but no specific requirement was provided in the request. ### What I Need to Clarify Before I can proceed with the remaining steps, please provide: | Missing Information | Impact | |---------------------|---------| | What business logic should execute? | Determines the rule script and validation | | Is this for data validation, transformation, or automation? | Affects `setAbortAction()` usage | | What field(s) should be read or written? | Must exist in table schema (verified in Step 3) | | Are there any conditions that should gate execution? | Affects rule performance and order | | Is this for validation or side-effect action? | Determines `before` vs `after` rule type | | Role-based or global scope? | Affects `gs.hasRole()` checks needed | Example clarifications needed: - "When state changes to 'Resolved', automatically close the incident" - "When priority becomes Critical, notify manager" - "Validate email format in short_descripti✔ Capability completed (1 data points gathered) # Business Rule Creation Analysis ## ⚠️ CRITICAL: Missing Requirement Information This is a critical gap: The requirement specifies `<not provided>` for: - Table name: Cannot determine which table the rule should apply to - Business requirement: Cannot determine what business logic needs to be implemented - Field names: Cannot verify field existence or types --- ## 📋 Step 1 — Understand the Requirement ### What's Missing | Element | Status | Needed For | |---------|--------|------------| | Target Table | `<not provided>` | Rule location | | Trigger Event | *not specified* | Execution timing | | Business Logic | `<not provided>` | Rule functionality | | Field Names | *not specified* | Schema validation | | Conditions | *not specified* | Rule gating | ### Clarification Needed To proceed correctly, I need: 1. Target table name (e.g., `sn_grc_metric_definition`, `sys_case`, etc.) 2. Business requirement description (e.g., "Set status to resolved when...", "Validate field X when...") 3. Specific field names to read/write 4. Role-based access requirements if applicable 5. Performance considerations (sync vs async) ### Alternative: Demonstration Scenario Would you like me to demonstrate the full process using a realistic scenario based on your instance's existing rules? Here's what I'd propose: Assumed Scenario: A Security Operations (SN_TI) table that validates incident severity levels Assumed Table: `sn_ti_m2m_task_attack_mode` (based on existing rules in your instance) Assumed Requirement: "Set severity to 'High' if impact field is critical" Assumed Trigger: Insert/Update --- ## 📋 Step 2 — Check Existing Rules on Table ### Existing Business Rules (Sample from your instance) | Name | Table | When | Order | Active | |------|-------|------|-------|--------| | Add Case IOC Entry | sn_ti_m2m_task_attack_mode | after | 100 | ✅ | | Update child metric confidential status | sn_grc_metric_definition | after | 100 | ✅ | | Validate duplicate search source | ais_search_profile_ais_search_source_m2m | before | 50 | ✅ | | Delete model components for simple model | sn_ent_model | before | 200 | ✅ | ### Conflict Analysis - Potential Conflict: Multiple "before" and "after" rules on similar tables - Recommendation: Execution order must be managed carefully (order 100, 200, etc.) --- ## 📋 Step 3 — Check Table Schema Cannot complete without table name Please provide the actual table name so I can: - Verify field existence - Confirm field types (number, string, text, select, etc.) - Check max lengths and indexes --- ## 📋 Step 4 — Generate the Script ... (137 more lines — full output truncated for screenshot)
← All 26 example outputs Apex AI Skills →