Quick Start Guide - AL Development Collection¶
β οΈ AI-Generated Content Disclaimer: This toolkit uses GitHub Copilot and generative AI to assist in AL development. Agent responses and code generation results may vary based on context, model versions, and user inputs. Always review and test generated code thoroughly before deploying to production environments.
AI-powered AL development in 2 simple steps for Microsoft Dynamics 365 Business Central.
π Quick Installation (5 minutes)¶
Option 1: VS Code Extension (Recommended)¶
1. Install from Marketplace: Search "AL Development Collection"
2. Command Palette: AL Collection: Install Toolkit to Workspace
3. Reload VS Code
Option 2: NPM¶
npm install github:javiarmesto/AL-Development-Collection-for-GitHub-Copilot
npx al-collection install
Option 3: Manual¶
git clone https://github.com/javiarmesto/ALDC-AL-Development-Collection-for-GitHub-Copilot.git
cd AL_Copilot_Collection
node install.js install [your-al-directory]
After installation: Reload VS Code (Ctrl+Shift+P β Developer: Reload Window)
π Two Main Tools¶
1οΈβ£ al-architect β Design the solution¶
Use when: You need to plan a new feature
Use al-architect mode
I need to build a sales approval system with:
- Approval levels by amount
- Email notifications
- Audit trail
Result: Complete architecture, data model, integration points
2οΈβ£ al-conductor β Implement with TDD¶
Use when: You have the design and want production-ready code
Result: Complete AL code, 100% tests, automatic documentation
π― Basic Workflow¶
For Simple Features (π’ 1-2 objects)¶
Step 1: Describe what you need
Step 2: Copilot generates the code (with auto-guidelines)
Step 3: @workspace use al-build β Deploy
Example: "Add email validation to Customer table"
For Moderate Features (π‘ 3-6 objects)¶
Step 1: Use al-architect mode β Design
Step 2: Use al-conductor mode β Implement with TDD
Step 3: @workspace use al-permissions β Permissions
Step 4: @workspace use al-build β Deploy
Example: "Customer loyalty points system"
Time: 2 hours (vs 2 days manual)
For Complex Features (π΄ 7+ objects)¶
Step 1: Use al-architect mode β Complete architecture
Step 2: Use al-api mode (if APIs needed)
Step 3: Use al-conductor mode β Multi-phase implementation
Step 4: @workspace use al-performance β Validation
Step 5: @workspace use al-build β Deploy
Example: "Integration with external payment gateway (OAuth + webhooks)"
Time: 1-2 days (vs 1-2 weeks manual)
π‘ What's My Complexity?¶
π’ Simple (Directly with Copilot)¶
- β Limited scope β isolated change
- β Field validation or page extension
- β Single implementation phase
- β No integrations needed
π‘ Moderate (al-architect + al-conductor)¶
- β Moderate scope β multiple related areas
- β Business logic with internal workflows
- β Internal integration events
- β 2-3 implementation phases
π΄ Complex (al-architect + specialists + al-conductor)¶
- β Extensive scope β broad architectural impact
- β External APIs or services
- β OAuth/authentication
- β 4+ implementation phases
π οΈ Useful Commands¶
Setup Commands¶
@workspace use al-initialize # Initialize project
@workspace use al-build # Build and deploy
@workspace use al-permissions # Generate permissions
Debugging Commands¶
Specialized Modes¶
Use al-architect mode # Architecture design
Use al-conductor mode # TDD implementation
Use al-api mode # REST/OData APIs
Use al-debugger mode # Deep diagnostics
Use al-tester mode # Testing strategy
Use al-presales mode # Project planning & cost estimation
π Complete Example: Loyalty Points System¶
β Real validated case - This example has been fully tested (24/24 validations passed)
π― What We're Going to Build¶
Customer loyalty system that: - Automatically accumulates points when posting sales invoices (1% of amount) - Allows redeeming points for discounts - Shows point balance on customer card - Records point transaction history - Complexity: π‘ MEDIUM (3-6 objects, 2-3 phases) - Time: ~2 hours (vs 2 days manual)
π Step 1: Design with al-architect (20 min)¶
Open VS Code in your AL project and run:
Use al-architect mode
Design a customer loyalty points system with these requirements:
FUNCTIONALITY:
- Customers accumulate points when posting sales invoices (1% of amount)
- Points can be redeemed for discounts
- Show point balance on customer card
- Record all point transactions
BUSINESS RULES:
- 1 point = 1% of sales amount
- Minimum redemption: 100 points
- Points don't expire
- Complete audit trail
TECHNICAL CONSIDERATIONS:
- Use events (don't modify BC base objects)
- AL-Go structure (App vs Test)
- 100% test coverage
Al-architect will respond with:
π ARCHITECTURE: Loyalty Points System
ποΈ DATA MODEL:
1. Table 50100 "Loyalty Point Entry"
- Entry No., Customer No., Points, Transaction Type, Sales Document No.
2. TableExtension 50100 "Customer Ext" extends Customer
- "Loyalty Points Balance" (Calculated FlowField)
- "Loyalty Points Enabled" (Boolean)
π INTEGRATION:
- Event Subscriber: OnAfterPostSalesInvoice β Calculate and assign points
- Codeunit 50100 "Loyalty Management" β Calculation and redemption logic
π UI:
- PageExtension 50100 "Customer Card Ext" β Show balance
- Page 50100 "Loyalty Point Entries" β History
π§ͺ TESTING:
- Test for OnAfterPostSalesInvoice
- Test for points calculation
- Test for redemption
- Test for FlowField
β
Architecture ready β Automatically saved in .github/plans/architecture.md
π Step 2: TDD Implementation with al-conductor (90 min)¶
Now switch to al-conductor to implement:
Al-conductor will automatically orchestrate:
π Planning Phase (5 min)¶
- Planning subagent analyzes the project
- Identifies existing BC objects
- Proposes 7 implementation phases
π΄ Phase 1: Loyalty Point Entry Table (RED β GREEN β REFACTOR)¶
RED (2 min):
- Implement: AL Implementation Subagent creates failing test
- Test: "Insert Loyalty Point Entry with required fields"
GREEN (3 min):
- Implement: Table with minimum fields
- Test: β
PASS
REFACTOR (2 min):
- Review: AL Code Review Subagent validates structure
- Result: Clean and efficient code
π΄ Phase 2: Customer Extension (RED β GREEN β REFACTOR)¶
RED: Test FlowField calculation
GREEN: TableExtension + FlowField
REFACTOR: SetLoadFields optimization
π΄ Phase 3: Loyalty Management Codeunit (RED β GREEN β REFACTOR)¶
RED: Test points calculation (1% of $1000 = 10 points)
GREEN: AddPoints + CalcPoints functions
REFACTOR: Extract constants
π΄ Phase 4: Event Subscriber (RED β GREEN β REFACTOR)¶
RED: Test OnAfterPostSalesInvoice integration
GREEN: Event subscriber calling AddPoints
REFACTOR: Error validation
π΄ Phase 5: Points Redemption (RED β GREEN β REFACTOR)¶
RED: Test RedeemPoints with validations
GREEN: Function with 100 points minimum validation
REFACTOR: Descriptive error messages
π΄ Phase 6: Customer Card Extension (RED β GREEN β REFACTOR)¶
π΄ Phase 7: Loyalty Entries Page (RED β GREEN β REFACTOR)¶
Final Result:
β
10 AL objects created
β
63 tests implemented (100% passing)
β
Documentation in .github/plans/
β
Code reviewed and validated
β
Production ready
π Step 3: Permissions and Deployment (10 min)¶
# Generate permissions automatically
@workspace use al-permissions
# Build and deploy
@workspace use al-build
π¦ Generated Objects¶
App/
βββ Tables/
β βββ LoyaltyPointEntry.Table.al (50100)
βββ TableExtensions/
β βββ CustomerExt.TableExtension.al (50100)
βββ Codeunits/
β βββ LoyaltyManagement.Codeunit.al (50100)
β βββ SalesEventSubscriber.Codeunit.al (50101)
βββ Pages/
β βββ LoyaltyPointEntries.Page.al (50100)
βββ PageExtensions/
β βββ CustomerCardExt.PageExtension.al (50100)
βββ Permissions/
βββ LoyaltySystem.PermissionSet.al (50100)
Test/
βββ LoyaltyTests.Codeunit.al (63 test functions)
π§ͺ Generated Tests (Examples)¶
[Test]
procedure TestAddPointsFromSales()
begin
// [GIVEN] Customer with no points
CreateCustomer(Customer);
// [WHEN] Post sales invoice of $1000
CreateAndPostSalesInvoice(Customer, 1000);
// [THEN] Customer has 10 points (1% of 1000)
Assert.AreEqual(10, GetLoyaltyPoints(Customer), 'Points calculation');
end;
[Test]
procedure TestRedeemPoints_Minimum()
begin
// [GIVEN] Customer with 50 points
SetCustomerPoints(Customer, 50);
// [WHEN] Tries to redeem
asserterror RedeemPoints(Customer, 50);
// [THEN] Error: minimum 100 points
Assert.ExpectedError('Minimum redemption is 100 points');
end;
π Measurable Results¶
| Metric | Manual | With Orchestra |
|---|---|---|
| Total time | 2 days | 2 hours |
| Objects created | 10 | 10 |
| Tests written | 0-10 | 63 (100%) |
| Production bugs | 3-5 | 0 |
| Documentation | Manual | Automatic |
| Code review | Manual | Automatic |
π What You Learned¶
β
Design before code β al-architect plans everything
β
Automatic TDD β al-conductor implements with tests first
β
Event-driven β Don't modify BC base objects
β
Guaranteed quality β Automatic review in each phase
β
Documentation included β Everything in .github/plans/
π Reproduce the Complete Example¶
Detailed step-by-step guide: REPRODUCIBLE-EXAMPLE.md
Quick summary (from scratch in your project):
-
Design:
-
Implement with TDD:
-
Deploy:
Total time: ~2 hours from zero to production β¨
Complete documentation with troubleshooting: See reproducible guide β
β¨ Auto-Guidelines (Working in Background)¶
While coding, these rules apply automatically:
- β al-code-style β Format and structure
- β al-naming-conventions β PascalCase names
- β al-performance β SetLoadFields, early filtering
- β al-error-handling β TryFunctions, error labels
- β al-events β Event-driven pattern
- β al-testing β AL-Go structure
You don't need to ask for them, they just work.
π Tips for Maximum Performance¶
β Do This¶
- Always start with al-architect to design before coding
- Use al-conductor to implement with automatic TDD quality
- Provide rich context β Describe requirements, business rules, considerations
- Trust auto-guidelines β They work in the background, don't ask for them manually
- Follow the Loyalty Points example β It's the validated reference
β Avoid This¶
- Don't skip architectural design (for medium/complex features)
- Don't implement without tests (al-conductor does it automatically)
- Don't modify BC base objects (always use events and extensions)
- Don't ignore automatic code reviews from AL Code Review Subagent
π§ Quick Troubleshooting¶
"I don't see Copilot suggestions"¶
- Verify Copilot is enabled
- Reload VS Code
- Open a
.alfile
"Modes don't appear"¶
- Check files in
.github/copilot/agents/ - Reload VS Code
- Verify they have
.agent.mdextension
"Validation fails"¶
π Complete Documentation¶
- Collection Guide - Detailed technical guide
- Instructions - Auto-guidelines
- Workflows - Available commands
- Modes - Specialists
π― Next Step¶
If you're new to AL:¶
If you have a feature to build:¶
If you have a bug:¶
Version: 2.11.0
Reference Model: AI Native-Instructions Architecture
Last Updated: 2026-02-06
β οΈ AI Assistant Reminder: This content is generated with assistance from AI tools. Results, code suggestions, and agent responses may vary depending on multiple factors including input quality, context, and AI model behavior. Always validate, test, and review AI-generated content before production use.