The best prompts will follow a simple structure:
Role Assignment + Clear Task/Goal + Context/Constraints + Desired Output Format.
Remember these three core principles when writing your prompts:
Define the Role (Persona): AI ko batao ki use kya ban-na hai (e.g., Senior AL Developer, Git Expert). This sets the tone and expertise.
Be Specific (Clarity): Vague mat raho. Clearly mention Object Type (Table Extension, Page Extension), Object ID, Field Names, and exact requirement.
Define the Output (Constraint): AI ko batao ki output kaisa chahiye (e.g., "Only provide the AL code block", "Step-by-step instructions").
| Prompt ID | Scenario | Role and Prompt Example (Hinglish/English) |
|---|---|---|
| 1 | Table Extension | Act as a Senior BC AL developer. Create a table extension for the Customer table adding field "GST Registration No." with classification EndUserIdentifiableInformation. Provide only AL code. |
| 2 | Codeunit Function | Act as an AL expert. Write a function CalculateDiscount(SalesLineAmount: Decimal) that returns amount after 10% discount. Briefly explain. |
| 3 | Page Extension | Act as AL UI specialist. Extend Item Card (Page 30) with a new FastTab "Technical Details" after Invoicing FastTab including group Custom Specs. Provide code only. |
| 4 | Report Data Item | Act as BC Report Developer. Generate minimal DataItem section joining Sales Header (ID 36) and Sales Line on Document No. Use proper data item links. |
| 5 | Fix Compile Error | Act as AL debugger. Fix the error: 'The name MyProcedure does not exist'. Provide fixed code snippet and explanation why error occurred. |
| 6 | Best Practice Refactoring | Act as BC Best Practice Consultant. Refactor a complex AL procedure for readability and naming conventions. Provide refactored code in block. |
| 7 | Event Subscriber | Act as Events Expert. Write codeunit subscribing OnAfterInsertEvent of Vendor table. Check Vendor.Blocked and log application message if true. |
| 8 | Git Conflict Resolution | Act as Git Expert. Resolve merge conflict in AL_Object_1.al between feature/new-module and main branch step-by-step in VS Code. |
| 9 | Azure DevOps Pipeline | Act as DevOps Engineer. Provide basic YAML pipeline structure using AL-Go steps for BC AL extension build and publish. |
| 10 | Performance Analysis | Act as Performance Analyst. Provide troubleshooting steps for slow Sales Order List page in BC using Performance Toolkit and Custom telemetry. |
| 11 | Upgrade Analysis | Act as BC Upgrade Specialist. List top 3 AL breaking changes upgrading v24 to v25 with short examples for each. |
| 12 | PowerShell Scripting | Act as automation specialist. Write PowerShell command using AL-Go to clean AL project, build extension, and create test package. |
| 13 | GitHub Flow | Act as Git Master. Describe standard Git flow for new feature branch: branch creation, commit, pull request for main branch in 4 commands. |
| 14 | Debugging Strategy | Act as Debugging Mentor. Explain how to set AL breakpoint and debug in Cloud Sandbox from VS Code with key steps. |
| 15 | API Integration | Act as AL developer. Generate AL code to call an external REST API and parse JSON response. Provide sample code and explanation. |
| 16 | Batch Job Creation | Act as AL developer. Create a batch job to run a specific report nightly. Include scheduling code only. |
| 17 | Permission Set Creation | Act as Security Consultant. Write AL code to create custom Permission Set for a new role with specific object accesses. Provide XML snippet. |
| 18 | Page Action Extension | Act as AL UI Developer. Add a new action to Customer List page to open a custom report. Provide only AL action code. |
| 19 | Table Relation Setup | Act as AL developer. Define a relation between Sales Line and Item tables ensuring referential integrity. Show AL keys and properties. |
| 20 | Data Validation | Act as AL developer. Implement field validation on Credit Limit field in Customer table. Provide AL code and logic explanation. |
| 21 | Custom Notification | Act as AL developer. Write code to show custom notification message when a user opens a specific page. Provide code example. |
| 22 | Extension Installation | Act as AL developer. Explain steps to publish and install an AL extension on a BC SaaS environment. Provide PowerShell commands. |
| 23 | UI Customization | Act as AL UI specialist. Modify List page layout to add new sortable column. Provide AL page extension code. |
| 24 | Debugging Tips | Act as AL mentor. List top 5 debugging tips for AL coding in Visual Studio Code. Add brief description for each tip. |
| 25 | Workflow Automation | Act as AL Developer. Generate AL workflow code for automated approval of sales orders over a threshold. Include code and explanation. |
| 26 | Localization | Act as AL developer. Add localization support for a custom label in AL extension. Provide example AL labels and resource file. |
| 27 | Source Control Best Practices | Act as Git expert. List best practices for managing AL code in source control including branching and commit messages. |
| 28 | Error Handling | Act as AL developer. Implement try-catch style error handling in AL codeunit function. Show code example and error logging strategy. |
| 29 | Data Migration Scripts | Act as AL developer. Write AL code snippet to migrate data from old table to new extension table. Provide step-by-step explanation. |
| 30 | Performance Optimization | Act as AL performance expert. Suggest AL coding practices to optimize database queries in complex reports. Provide examples. |
| 31 | Security Roles Setup | Act as BC Security Consultant. Define custom roles with specific page and report permissions in AL. Provide example code snippet. |
| 32 | Event Publisher | Act as AL developer. Create new event publisher in a codeunit and subscriber in another codeunit. Provide example code for both. |
| 33 | Code Documentation | Act as AL mentor. Show best practices for documenting AL code using comments and XML documentation tags. Provide example block. |
| 34 | Unit Testing | Act as AL developer. Write unit test for a function calculating discounts. Provide code and explanation of test assertions. |
| 35 | Custom Report Design | Act as AL Report Developer. Define a custom report layout with grouped sections and custom headers. Provide AL RDLC layout snippet. |
| 36 | Using Table Filters | Act as AL developer. Write code to apply complex filters on Sales Line table programmatically. Provide AL code snippet. |
| 37 | Integration with Power BI | Act as AL developer. Describe approach and AL code to export Business Central data for Power BI dashboards. |
| 38 | Adaptive Cards Notification | Act as AL developer. Send Adaptive Card notifications via Microsoft Teams using AL extension. Provide example code. |
| 39 | Recurring Job Setup | Act as AL developer. Setup recurring job queue entries for automated processing. Provide minimal AL code examples. |
| 40 | Data Encryption | Act as Security Expert. Implement encryption for sensitive fields in AL extension. Show sample encryption and decryption code. |
| 41 | Multi-Currency Handling | Act as AL developer. Handle transactions in multiple currencies with proper exchange rate application. Provide example code. |
| 42 | Integration with Azure Logic Apps | Act as AL developer. Write code to send data from AL to Azure Logic Apps via HTTP. Provide example snippet. |
| 43 | Background Processing | Act as AL developer. Implement background processing for long-running tasks with status tracking. Provide example AL code. |
| 44 | Copy-Paste Code Snippets | Act as AL developer. Provide a collection of reusable AL code snippets for common tasks like date handling, string manipulation, etc. |
| 45 | Notification Setup | Act as AL developer. Send custom notifications to users based on event triggers. Provide example codeunit. |
| 46 | Workspace Setup for AL | Act as AL mentor. Describe best practices for setting up Visual Studio Code workspace for AL projects with extensions. |
| 47 | Automated Documentation | Act as AL developer. Use tools or extensions to generate documentation automatically from AL code. Provide brief guide. |
| 48 | Pack and Publish Extension | Act as AL developer. Define steps to package, version, and publish an AL extension to AppSource or private repository. |
| 49 | Code Review Checklist | Act as AL mentor. Provide a checklist for reviewing AL code for best practices before merge or deployment. |
| 50 | Troubleshooting Common Issues | Act as AL mentor. List common AL errors and troubleshooting tips with sample resolutions. |
1. Table Extension for New Field
Prompt:
"Act as a Senior Business Central AL Developer. Create an AL table extension for the Customer table. Add a field named 'GST Registration No.' with data type Code and data classification EndUserIdentifiableInformation. Provide only the complete AL code block."
2. Function to Calculate Discounted Sales Line Amount
Prompt:
"Act as an expert AL Coder. Write a Codeunit function CalculateDiscountedSalesLineAmount(SalesLineAmount: Decimal) that returns SalesLineAmount - (SalesLineAmount * 0.10). Briefly explain how this function works."
3. Page Extension to Add FastTab
Prompt:
"Act as an AL UI Specialist. Write an AL Page Extension for the Item Card (Page 30). Add a new FastTab called 'Technical Details' immediately after the 'Invoicing' FastTab. Inside this FastTab, add a group named 'Custom Specs'. Provide only the AL code without explanation."
4. Minimal Report DataItem Section for Joined Tables
Prompt:
"Act as a BC Report Developer. Generate the minimal DataItem section of an AL Report object joining Sales Header (ID 36) and Sales Line tables using a data item link on the Document No. Show the AL code for this DataItem section."
5. Fix Compile Error in AL Code
Prompt:
"I am getting a compile error: 'The name MyProcedure does not exist in the current context' in the following code snippet: [paste code here]. Act as an AL debugger, provide the corrected code snippet, and explain the reason for the error."
6. Best Practice Refactoring of Procedure
Prompt:
"Act as a BC Best Practice Consultant. Review this AL procedure code: [paste long/complex procedure]. Suggest refactorings to improve readability and follow naming conventions. Provide the refactored code only."
7. Event Subscriber for Vendor Table After Insert
Prompt:
"Act as an Events Expert. Write an AL codeunit with a function subscribed to the OnAfterInsertEvent of the Vendor table. Inside the subscriber, check if Vendor.Blocked is true, and if so, log a message to the application log. Provide code only."
8. Git Conflict Resolution Steps in VS Code
Prompt:
"Act as a Git Expert. A merge conflict occurred in file AL_Object_1.al when merging feature/new-module into main branch. Provide step-by-step conflict resolution instructions to fix this in VS Code."
9. Azure DevOps YAML Pipeline for BC Extension
Prompt:
"Act as a DevOps Engineer. Provide a basic YAML pipeline structure for an Azure DevOps build pipeline of a Business Central AL extension using AL-Go. Focus on defining jobs and steps only."
10. Performance Troubleshooting for Slow BC Page
Prompt:
"Act as a Performance Analyst. User reports that the Sales Order List page loads slowly. Suggest troubleshooting steps for an AL developer starting from using Performance Toolkit and Custom telemetry."
๐งฑ Prompt Template Format
Role Assignment: Define who ChatGPT should act as (expert role).
Task/Goal: Define the exact outcome you want.
Context/Constraints: Add object name, BC version, coding rules, or style constraints.
Desired Output Format: Define how the output should appear (code, explanation, table, etc.).
๐ง TOP 50 BUSINESS CENTRAL AL PROMPT ENGINEERING EXAMPLES
๐งฉ CODE CREATION & EXTENSION STRUCTURE
-
Create a New AL Table
๐ก Scenario: You need a new custom table for “Salesperson Target Setup”.
Prompt:
“Generate a Business Central AL table object for ‘Salesperson Target Setup’ with fields: Salesperson Code (Code20), Target Amount (Decimal), Month (Date). Include keys, DataClassification, and caption formatting best practices.”
-
Create a Page for Custom Table
“Create a List and Card page for table ‘Salesperson Target Setup’. Include page actions for New, Edit, and Delete and use proper ApplicationArea and ToolTip for each field.”
-
Create a Report Layout
“Generate an AL report object for listing Customer Ledger Entries filtered by Posting Date. Include totals at the bottom. Provide dataset and layout XML structure.”
-
Table Extension
“Extend the ‘Sales Header’ table to add field ‘Custom Order Type (Code20)’ and make it visible on the Sales Order page under the General FastTab.”
-
Page Extension
“Extend ‘Customer Card’ page to show field ‘Credit Rating (Integer)’ in a new FastTab named ‘Credit Info’. Include a tooltip and editable=false property.”
-
Codeunit Template
“Generate a standard AL Codeunit template for reusable functions like logging or validation. Include OnRun, local/global procedure example, and region formatting.”
-
Enum Creation
“Create an Enum named ‘Order Source Type’ with values: Manual, EDI, API, and Partner Portal. Mark it extensible and link a caption for each.”
-
Interface Example
“Create an AL interface for ‘IOrderProcessor’ defining methods ValidateOrder, PostOrder, and SendNotification with proper signatures.”
⚙️ CODE OPTIMIZATION & PERFORMANCE
-
Optimize a Loop
“Review this AL loop and optimize for performance by reducing database reads: [paste code]. Suggest improvements.”
-
Query Optimization
“Given this query object [paste code], optimize it for large datasets and explain index/key considerations.”
-
Refactor Codeunit
“Refactor this codeunit to follow SOLID principles and modularize logic using single-responsibility. [paste code].”
-
Caching Suggestions
“Suggest how to cache frequent lookups in this code to reduce database calls: [paste code].”
-
Performance Benchmark
“Give me a test procedure to benchmark runtime performance for this function: [paste code].”
๐งพ EVENTS, SUBSCRIPTIONS, AND EXTENSIBILITY
-
Publisher Event Example
“Create an OnBeforeValidate event publisher for the ‘Customer Card’ page to allow other extensions to override default behavior.”
-
Event Subscriber Template
“Write an AL event subscriber for OnAfterPostSalesDoc event in ‘Sales Post Codeunit’. Include best practices for naming and local variables.”
-
Custom Event Model
“Design a proper event model for custom extension ‘Expense Approval Workflow’ to expose extensibility points.”
-
Find Available Events
“List standard events in the ‘Item Journal Post Line’ codeunit that can be used to extend posting logic.”
-
Event Best Practice
“Explain the difference between IntegrationEvent and BusinessEvent in AL and when to use each.”
๐งฐ DEBUGGING & ERROR HANDLING
-
Error Handling Template
“Give me a reusable AL function pattern for TRY-CATCH error handling with clear messages using GetLastErrorText().”
-
Debug Scenario
“Explain how to debug an extension deployed to Sandbox with Visual Studio Code step-by-step.”
-
Log Framework
“Generate an AL logging module to record user actions in a custom Log table. Include procedure LogAction(UserID, Action, Description).”
-
Telemetry Integration
“Explain how to use the Session.LogMessage method for custom telemetry logging in AL.”
๐งฎ BUSINESS LOGIC AUTOMATION
-
Sales Discount Calculation
“Write a function in AL to calculate progressive discounts (10% up to ₹10,000, 15% above ₹10,000). Return total discount amount.”
-
Auto-Numbering Function
“Generate a procedure to auto-generate a running document number using a ‘No. Series’ setup.”
-
Approval Workflow
“Design AL codeunit structure for ‘Expense Approval Workflow’ using workflow events and approval entries.”
-
Validation Function
“Write a function ValidateCustomerCreditLimit(SalesHeader) that blocks posting if outstanding > CreditLimit.”
-
Scheduled Job Queue Example
“Create a codeunit that runs as a Job Queue to auto-close old service orders older than 60 days.”
๐งฉ INTEGRATION & API
-
API Page Example
“Create a custom API page for ‘Sales Order Summary’ exposing fields: Order No., Customer Name, Total Amount, and Status.”
-
Webhook Example
“Show how to send a JSON payload to an external API using HttpClient when a Sales Invoice is posted.”
-
OAuth2 Integration
“Explain and generate AL code for connecting to an external REST API using OAuth2 authentication.”
-
JSON Parsing
“Write AL code to parse this JSON response [paste JSON] and insert data into custom ‘Integration Log’ table.”
-
File Upload Example
“Generate AL example for uploading a CSV file and reading its contents using FileManagement codeunit.”
๐ GIT / DEVOPS / DEPLOYMENT
-
Git Branching Workflow
“Suggest an ideal Git branching strategy for a Business Central AL extension project (Dev, Test, UAT, Prod).”
-
PowerShell Deployment Script
“Generate PowerShell script to publish .app file to BC environment using bccontainerhelper or AL-Go style.”
-
AL-Go CI/CD Pipeline
“Explain how to set up AL-Go for GitHub for automated build and test of my AL extension.”
-
Automated Versioning
“Give AL code or PowerShell logic to auto-increment version number on each pipeline run.”
-
Symbol Reference Issue
“Help me fix the error ‘Symbol not found: Table 27’ during build; guide me how to resolve symbol reference issues.”
-
Docker Sandbox Setup
“Guide me to set up Business Central Docker Sandbox with my extension deployed automatically.”
๐ TESTING
-
Test Codeunit Example
“Generate AL test codeunit for validating ‘Customer Creation’ logic using ASSERT statements.”
-
Test Isolation
“Explain how to isolate data for each test method using TestSuite in AL.”
-
Mock Data Example
“Generate mock data creation procedure for ‘Item’ and ‘Customer’ for testing scenarios.”
-
Code Coverage
“Explain how to enable code coverage in BC test framework and export results.”
๐งฎ DATA MIGRATION & UTILITIES
-
CSV Import Helper
“Write AL codeunit for importing Customer Master data from CSV into Customer table.”
-
Data Upgrade Codeunit
“Create an upgrade codeunit to migrate old ‘Custom Field’ data from v1.0 to v2.0.”
-
Background Processing
“Show how to use Task Scheduler to process records asynchronously in background.”
๐ DOCUMENTATION & STANDARDS
-
Naming Convention Reference
“Provide AL naming conventions for variables, procedures, tables, and pages aligned with Microsoft AL guidelines.”
-
Code Commenting Template
“Generate a standard header and inline comment template for AL codeunits and pages.”
-
Documentation Generator
“Create a PowerShell or AL script that extracts object names and descriptions to generate documentation.”
๐ก ADVANCED / CUSTOM SCENARIOS
-
Event-Driven Architecture
“Design an event-driven AL extension architecture for a modular invoicing system with 3 custom modules.”
-
AI Assistant Integration
“Suggest how to integrate an external AI API (like Azure OpenAI) with BC using AL and custom API page for internal automation.”
⚡ 50 AI PROMPTS FOR BUSINESS CENTRAL AL DEVELOPERS (Productivity-Focused)
๐น 1. Create New AL Table
Role Assignment: Act as a senior Business Central AL solution architect.
Task/Goal: Create a new AL table object named “Salesperson Target Setup”.
Context/Constraints: Include fields Salesperson Code (Code20), Target Amount (Decimal), Month (Date). Add keys, captions, and DataClassification attributes.
Desired Output Format: Provide clean AL code with comments explaining each field.
๐น 2. Generate List Page
Role Assignment: Act as a Business Central AL UI designer.
Task/Goal: Build a List page for table "Salesperson Target Setup".
Context/Constraints: Use proper ApplicationArea, ToolTips, and action triggers.
Desired Output Format: Complete AL page object code ready to compile.
๐น 3. Create Card Page
Role Assignment: Act as a UI/UX-oriented AL developer.
Task/Goal: Build a Card page for “Salesperson Target Setup”.
Context/Constraints: Use FactBox area, grouping, and FastTabs for better readability.
Desired Output Format: AL code with detailed layout and comments.
๐น 4. Extend Table
Role Assignment: Act as an AL extensibility expert.
Task/Goal: Extend table “Sales Header” to add a new field “Custom Order Type (Code20)”.
Context/Constraints: Use appropriate DataClassification and positioning in a logical sequence.
Desired Output Format: AL tableextension object code.
๐น 5. Extend Page
Role Assignment: Act as a Business Central page customization specialist.
Task/Goal: Extend “Customer Card” page to show field “Credit Rating (Integer)” under a new FastTab.
Context/Constraints: Read-only, ApplicationArea=All.
Desired Output Format: AL pageextension code snippet.
๐น 6. Create Codeunit Template
Role Assignment: Act as an AL code library designer.
Task/Goal: Generate a reusable AL codeunit structure for utility functions (e.g., logging, validation).
Context/Constraints: Must include regions, OnRun(), and example local/global procedures.
Desired Output Format: AL code with documentation comment header.
๐น 7. Create Enum
Role Assignment: Act as an AL data modeler.
Task/Goal: Define Enum “Order Source Type” (Manual, API, Portal, EDI).
Context/Constraints: Extensible = true; each value has caption.
Desired Output Format: AL Enum code.
๐น 8. Create Interface
Role Assignment: Act as a Business Central interface designer.
Task/Goal: Define interface “IOrderProcessor” with methods: ValidateOrder(), PostOrder(), SendNotification().
Context/Constraints: Use standard AL interface syntax.
Desired Output Format: AL interface object code.
๐น 9. Optimize Loop Performance
Role Assignment: Act as an AL performance optimization expert.
Task/Goal: Optimize the following AL loop for large datasets.
Context/Constraints: Minimize database reads, use temporary tables if needed.
Desired Output Format: Optimized code version + explanation of improvements.
๐น 10. Query Optimization
Role Assignment: Act as a query optimization specialist.
Task/Goal: Analyze and improve query object for performance.
Context/Constraints: Consider key usage, filters, and FlowFields.
Desired Output Format: Optimized query AL code + reasoning.
๐น 11. Refactor Codeunit
Role Assignment: Act as a clean-code AL architect.
Task/Goal: Refactor codeunit [paste code] following SOLID principles.
Context/Constraints: Improve modularity, readability, and reusability.
Desired Output Format: Refactored codeunit with inline comments.
๐น 12. Cache Lookups
Role Assignment: Act as a performance-oriented AL engineer.
Task/Goal: Suggest caching approach for frequent table lookups in the given AL code.
Context/Constraints: Maintain functional correctness; use temporary variables or single-instance codeunit if required.
Desired Output Format: Revised code snippet with caching + explanation.
๐น 13. Benchmark Performance
Role Assignment: Act as a testing automation engineer.
Task/Goal: Write AL code to benchmark execution time of a function.
Context/Constraints: Use Time functions and log output to message or table.
Desired Output Format: AL test procedure example.
๐น 14. Add Publisher Event
Role Assignment: Act as an extensibility architect.
Task/Goal: Add an OnBeforeValidate publisher in Customer table.
Context/Constraints: Use IntegrationEvent and ensure parameters are VAR.
Desired Output Format: AL event publisher code with comments.
๐น 15. Create Event Subscriber
Role Assignment: Act as an AL subscriber developer.
Task/Goal: Subscribe to event OnAfterPostSalesDoc in Sales Post Codeunit.
Context/Constraints: Proper naming, EventSubscriberAttribute, use global scope where needed.
Desired Output Format: AL event subscriber procedure code.
๐น 16. Workflow Event Design
Role Assignment: Act as a Business Central workflow designer.
Task/Goal: Design event flow for custom “Expense Approval” system.
Context/Constraints: Include publisher, subscriber, and status update event chain.
Desired Output Format: High-level diagram + sample AL code snippets.
๐น 17. Find Standard Events
Role Assignment: Act as an AL API reference expert.
Task/Goal: List available integration events in “Item Journal Post Line” codeunit.
Context/Constraints: Include event names and parameters.
Desired Output Format: Table format listing Event Name + Description.
๐น 18. Explain Event Types
Role Assignment: Act as a Microsoft AL documentation expert.
Task/Goal: Explain difference between IntegrationEvent and BusinessEvent.
Context/Constraints: Include use-cases from real BC extensions.
Desired Output Format: Structured comparison table + summary.
๐น 19. TRY-CATCH Template
Role Assignment: Act as an AL error-handling specialist.
Task/Goal: Write TRY-CATCH pattern using GetLastErrorText().
Context/Constraints: Follow best practices for displaying user-friendly errors.
Desired Output Format: AL code with example usage.
๐น 20. Debug Guide
Role Assignment: Act as a Business Central debugging instructor.
Task/Goal: Explain step-by-step how to debug AL code on a Sandbox via VS Code.
Context/Constraints: Include launch.json setup and breakpoints.
Desired Output Format: Step list with screenshots reference or notes.
๐น 21. Logging Framework
Role Assignment: Act as an AL logging framework designer.
Task/Goal: Design reusable LogAction(UserID, Action, Description) function.
Context/Constraints: Store in custom “Log Entries” table; use Insert(true).
Desired Output Format: Table + Codeunit AL code.
๐น 22. Add Telemetry
Role Assignment: Act as a telemetry integration expert.
Task/Goal: Use Session.LogMessage for custom telemetry events.
Context/Constraints: Add meaningful message IDs and event types.
Desired Output Format: AL code example.
๐น 23. Discount Calculation
Role Assignment: Act as a business rule automation developer.
Task/Goal: Write function to calculate discount based on amount tiers.
Context/Constraints: <10,000 = 10%; >=10,000 = 15%.
Desired Output Format: AL procedure returning decimal discount.
๐น 24. Auto Document Numbering
Role Assignment: Act as a numbering system expert.
Task/Goal: Auto-generate running number using No. Series.
Context/Constraints: Error if no series found.
Desired Output Format: AL function code.
๐น 25. Approval Workflow
Role Assignment: Act as an AL workflow implementer.
Task/Goal: Build approval logic for “Expense Request”.
Context/Constraints: Use workflow events and approval entries.
Desired Output Format: Codeunit + step explanation.
๐น 26. Credit Limit Validation
Role Assignment: Act as a functional AL developer.
Task/Goal: Prevent posting if Customer outstanding > CreditLimit.
Context/Constraints: Validate on Sales Header OnBeforePost.
Desired Output Format: AL code example.
๐น 27. Job Queue Task
Role Assignment: Act as a background task automation expert.
Task/Goal: Create job queue codeunit that closes orders older than 60 days.
Context/Constraints: Use Record.FindSet and Modify().
Desired Output Format: AL job queue codeunit.
๐น 28. API Page
Role Assignment: Act as a Business Central API designer.
Task/Goal: Build custom API page exposing Sales Order summary.
Context/Constraints: Include header fields only, JSON endpoint format.
Desired Output Format: AL API page code.
๐น 29. Webhook Call
Role Assignment: Act as an integration engineer.
Task/Goal: Send JSON payload to API after Sales Invoice posting.
Context/Constraints: Use HttpClient, Headers, and Post method.
Desired Output Format: AL code with JSON sample.
๐น 30. OAuth2 Example
Role Assignment: Act as an external API integration expert.
Task/Goal: Connect to an external API with OAuth2.
Context/Constraints: Use HttpClient, store tokens securely.
Desired Output Format: AL code + explanation.
๐น 31. Parse JSON
Role Assignment: Act as an AL data transformation specialist.
Task/Goal: Parse given JSON and insert data into custom table.
Context/Constraints: Use JsonObject, JsonArray, and Evaluate().
Desired Output Format: AL code example.
๐น 32. File Upload
Role Assignment: Act as a file handling expert.
Task/Goal: Upload CSV file and read contents into temporary record.
Context/Constraints: Use FileManagement codeunit.
Desired Output Format: AL codeunit example.
๐น 33. Git Branch Strategy
Role Assignment: Act as a DevOps coach for AL developers.
Task/Goal: Define branching strategy for multi-environment AL project.
Context/Constraints: Dev → Test → UAT → Prod flow.
Desired Output Format: Diagram + branch naming conventions.
๐น 34. PowerShell Deployment
Role Assignment: Act as a BC DevOps automation engineer.
Task/Goal: Generate PowerShell script to publish .app file.
Context/Constraints: Use bccontainerhelper Publish-BCContainerApp.
Desired Output Format: PowerShell script with comments.
๐น 35. AL-Go CI/CD Setup
Role Assignment: Act as CI/CD pipeline architect.
Task/Goal: Configure GitHub Actions using AL-Go template.
Context/Constraints: Auto build + test extension on push.
Desired Output Format: YAML file snippet.
๐น 36. Auto Versioning
Role Assignment: Act as a release automation engineer.
Task/Goal: Increment app.json version automatically on each pipeline.
Context/Constraints: Maintain major.minor.build format.
Desired Output Format: PowerShell snippet.
๐น 37. Fix Symbol Error
Role Assignment: Act as a build troubleshooting expert.
Task/Goal: Fix “Symbol not found: Table 27” issue during compile.
Context/Constraints: Explain missing dependencies and resolution steps.
Desired Output Format: Step-by-step fix guide.
๐น 38. Docker Sandbox
Role Assignment: Act as BC Docker container expert.
Task/Goal: Set up local BC sandbox with extension auto-deploy.
Context/Constraints: Use bccontainerhelper, specify version & artifact URL.
Desired Output Format: PowerShell script.
๐น 39. AL Test Codeunit
Role Assignment: Act as test automation developer.
Task/Goal: Create AL test codeunit to validate Customer creation.
Context/Constraints: Use ASSERT statements.
Desired Output Format: AL test codeunit.
๐น 40. Test Data Isolation
Role Assignment: Act as BC test environment designer.
Task/Goal: Ensure isolated test data per test method.
Context/Constraints: Use TestSuite framework.
Desired Output Format: AL example.
๐น 41. Mock Data Generator
Role Assignment: Act as test data generator expert.
Task/Goal: Create mock Item and Customer data.
Context/Constraints: Randomize Code, Name, and Balance.
Desired Output Format: AL helper codeunit.
๐น 42. Code Coverage Report
Role Assignment: Act as a QA automation specialist.
Task/Goal: Enable code coverage and export results.
Context/Constraints: Use BC Test Tool.
Desired Output Format: Command steps.
๐น 43. CSV Import
Role Assignment: Act as a data migration engineer.
Task/Goal: Import Customer data from CSV file.
Context/Constraints: Map fields, handle errors gracefully.
Desired Output Format: AL codeunit.
๐น 44. Data Upgrade
Role Assignment: Act as upgrade codeunit designer.
Task/Goal: Migrate data from custom field v1.0 to v2.0.
Context/Constraints: Use OnUpgradePerCompany().
Desired Output Format: AL upgrade codeunit.
๐น 45. Task Scheduler
Role Assignment: Act as background processing expert.
Task/Goal: Execute async task to process pending records.
Context/Constraints: Use TaskScheduler codeunit.
Desired Output Format: AL code snippet.
๐น 46. Naming Standards
Role Assignment: Act as AL coding standards coach.
Task/Goal: Define naming rules for variables, tables, pages, enums.
Context/Constraints: Follow Microsoft guidelines.
Desired Output Format: Table of naming conventions.
๐น 47. Comment Template
Role Assignment: Act as a documentation expert.
Task/Goal: Generate code comment header and inline style.
Context/Constraints: Use consistent block header format.
Desired Output Format: Example template.
๐น 48. Documentation Extractor
Role Assignment: Act as DevOps documentation specialist.
Task/Goal: Extract all object names and descriptions into a CSV.
Context/Constraints: Use PowerShell AL object scanning.
Desired Output Format: Script + sample output.
๐น 49. Modular Architecture
Role Assignment: Act as extension architect.
Task/Goal: Design modular invoicing extension using events.
Context/Constraints: Separate Posting, Validation, and Notification modules.
Desired Output Format: Diagram + event flow.
๐น 50. AI API Integration
Role Assignment: Act as AI integration architect.
Task/Goal: Connect Business Central to an external AI API (e.g., Azure OpenAI) for suggestion generation.
Context/Constraints: Use AL HttpClient + secure key handling.
Desired Output Format: AL code + explanation.
⚡ 50 BEST AI PROMPT EXAMPLES FOR BUSINESS CENTRAL AL DEVELOPERS
(Grouped by Object Type)
๐งฉ 1️⃣ TABLE OBJECT PROMPTS (Data Layer Design)
1. Create a new AL Table
Role Assignment: Act as a senior AL data architect.
Task/Goal: Create a new AL table “Sales Target Setup”.
Context/Constraints: Fields: Salesperson Code (Code20), Month (Date), Target Amount (Decimal). Add clustered primary key and captions.
Desired Output Format: AL table object code with comments.
2. Add Field Validation
Role Assignment: Act as a validation expert.
Task/Goal: Add validation trigger on Target Amount field.
Context/Constraints: Amount must be > 0, else throw error.
Desired Output Format: Complete AL table code snippet with trigger.
3. Table Relation Example
Role Assignment: Act as an AL relational design expert.
Task/Goal: Create a table with a field related to “Customer” table.
Context/Constraints: Use TableRelation property and enforce lookup.
Desired Output Format: AL table code showing correct relation syntax.
4. Add FieldGroup
Role Assignment: Act as UI metadata designer.
Task/Goal: Define DropDown field group for “Sales Target Setup”.
Context/Constraints: Include Salesperson Code and Target Amount.
Desired Output Format: Table with FieldGroup definition.
5. DataClassification
Role Assignment: Act as GDPR-compliant developer.
Task/Goal: Apply correct DataClassification to all fields.
Context/Constraints: Follow BC standards (CustomerContent, ToBeClassified, etc.).
Desired Output Format: AL table code with annotated DataClassification.
๐ช 2️⃣ TABLE EXTENSION PROMPTS
6. Extend “Customer” Table
Role Assignment: Act as an AL extensibility architect.
Task/Goal: Add field “Customer Segment (Option)” to Customer table.
Context/Constraints: Options: Gold, Silver, Bronze; store as Enum if possible.
Desired Output Format: AL tableextension code.
7. Add FlowField
Role Assignment: Act as data aggregation expert.
Task/Goal: Add FlowField “Total Open Orders” to Customer table.
Context/Constraints: Calculate from Sales Header (Status=Open).
Desired Output Format: AL code with CalcFormula example.
8. Add OnValidate Trigger
Role Assignment: Act as field validation expert.
Task/Goal: Trigger on new field to enforce rule.
Context/Constraints: If Segment = Gold → minimum balance ₹10,000.
Desired Output Format: AL field OnValidate trigger code.
9. Add Obsolete Field
Role Assignment: Act as versioning expert.
Task/Goal: Mark old custom field as Obsolete.
Context/Constraints: Use ObsoleteState and ObsoleteReason.
Desired Output Format: AL code snippet.
10. Add Table Extension for Custom Logic
Role Assignment: Act as custom logic architect.
Task/Goal: Add new Boolean field “Is Verified” to Vendor table.
Context/Constraints: Field editable only if Vendor.Status=Active.
Desired Output Format: Table extension + conditional validation.
๐ 3️⃣ PAGE OBJECT PROMPTS
11. Create List Page
Role Assignment: Act as BC page UI designer.
Task/Goal: Create List page for “Sales Target Setup”.
Context/Constraints: Include filters, ApplicationArea, and actions.
Desired Output Format: Full AL page object.
12. Create Card Page
Role Assignment: Act as UX-oriented AL developer.
Task/Goal: Create Card page for the same table.
Context/Constraints: Group fields logically, use FastTabs.
Desired Output Format: AL code.
13. Add FactBox
Role Assignment: Act as FactBox designer.
Task/Goal: Add FactBox showing Customer Balance in “Customer Card”.
Context/Constraints: Use Part and SubPageLink properties.
Desired Output Format: Page extension or composite page code.
14. Page Actions
Role Assignment: Act as UI action designer.
Task/Goal: Add “Recalculate Target” action button on List page.
Context/Constraints: Runs codeunit function on click.
Desired Output Format: Page action AL code.
15. Add Page Filter
Role Assignment: Act as usability expert.
Task/Goal: Apply filter to show only current month’s records.
Context/Constraints: Use OnOpenPage trigger.
Desired Output Format: AL code snippet.
๐งฑ 4️⃣ PAGE EXTENSION PROMPTS
16. Extend “Customer Card” Page
Role Assignment: Act as page extension developer.
Task/Goal: Add new FastTab “Customer Segment Info”.
Context/Constraints: Display fields Segment and LoyaltyPoints.
Desired Output Format: Page extension code.
17. Add Action Group
Role Assignment: Act as UX consistency expert.
Task/Goal: Add new ActionGroup “Customer Tools”.
Context/Constraints: Contain actions for Custom Reports.
Desired Output Format: Page extension AL snippet.
18. Add Cue to RoleCenter
Role Assignment: Act as role-based designer.
Task/Goal: Add Cue for “Pending Sales Targets” on RoleCenter.
Context/Constraints: Use FlowField and Count triggers.
Desired Output Format: CueGroup AL code.
19. Modify Existing Field Behavior
Role Assignment: Act as AL refactoring specialist.
Task/Goal: Change visibility of “Blocked” field based on custom condition.
Context/Constraints: Editable=false if Status=Inactive.
Desired Output Format: Page extension code.
20. Add Tooltip and Help
Role Assignment: Act as documentation-friendly developer.
Task/Goal: Add tooltip for “Credit Rating” field in Customer page.
Context/Constraints: Tooltip should describe rating logic.
Desired Output Format: Updated field code snippet.
๐งฎ 5️⃣ REPORT OBJECT PROMPTS
21. Create Report Dataset
Role Assignment: Act as report data designer.
Task/Goal: Build report showing Customer-wise Sales Summary.
Context/Constraints: Use Sales Invoice Header/Line tables.
Desired Output Format: AL report object.
22. Add RDLC Layout
Role Assignment: Act as report designer.
Task/Goal: Include totals and grouping in layout.
Context/Constraints: Provide XML layout dataset structure.
Desired Output Format: AL + layout XML code.
23. Request Page Filters
Role Assignment: Act as AL filter designer.
Task/Goal: Add filters for Customer, Date Range on RequestPage.
Context/Constraints: Use proper Caption and ToolTip.
Desired Output Format: AL code snippet.
24. Report OnAfterGetRecord Logic
Role Assignment: Act as report logic developer.
Task/Goal: Add custom calculation in OnAfterGetRecord.
Context/Constraints: Calculate margin percentage.
Desired Output Format: AL code with calculation.
25. Report Extension
Role Assignment: Act as extensibility expert.
Task/Goal: Extend standard “Customer - Top 10 List” report to include “Region” column.
Context/Constraints: Use reportextension object.
Desired Output Format: AL reportextension code.
๐ง 6️⃣ CODEUNIT PROMPTS (Logic Layer)
26. Create Utility Codeunit
Role Assignment: Act as AL modular developer.
Task/Goal: Create reusable “Helper Functions” codeunit.
Context/Constraints: Include example procedure for date difference.
Desired Output Format: AL codeunit code.
27. Create Posting Codeunit
Role Assignment: Act as process automation expert.
Task/Goal: Develop custom posting routine for Expense Entry.
Context/Constraints: Include validation, ledger posting, and commit pattern.
Desired Output Format: AL codeunit with comments.
28. Add Event Publisher
Role Assignment: Act as event-driven architect.
Task/Goal: Add IntegrationEvent “OnBeforePostExpense()”.
Context/Constraints: Use [IntegrationEvent(false, false)].
Desired Output Format: AL event publisher snippet.
29. Add Event Subscriber
Role Assignment: Act as extension subscriber designer.
Task/Goal: Subscribe to OnBeforePostExpense event.
Context/Constraints: Use EventSubscriber attribute and handle logic.
Desired Output Format: AL codeunit snippet.
30. Logging Function
Role Assignment: Act as audit log implementer.
Task/Goal: Add procedure LogUserAction(UserID, Action, Description).
Context/Constraints: Store in “Log Entries” table.
Desired Output Format: AL function code.
๐ 7️⃣ QUERY OBJECT PROMPTS
31. Create Query Object
Role Assignment: Act as AL query designer.
Task/Goal: Build query combining “Sales Header” and “Customer”.
Context/Constraints: Include Customer Name, Order Total.
Desired Output Format: AL query object.
32. Add Totals in Query
Role Assignment: Act as data summarization expert.
Task/Goal: Include SUM(Total Amount) grouped by Customer.
Context/Constraints: Use DataItemLink and MethodType=Sum.
Desired Output Format: AL query code.
33. Query for Dashboard
Role Assignment: Act as RoleCenter query designer.
Task/Goal: Build query showing Pending Orders by Status.
Context/Constraints: Sort by Order Date descending.
Desired Output Format: AL query code.
34. Query as API
Role Assignment: Act as API integration expert.
Task/Goal: Expose query results via API.
Context/Constraints: Make it available using APIPage.
Desired Output Format: Query + APIPage code.
35. Query Performance
Role Assignment: Act as query optimization expert.
Task/Goal: Optimize slow query.
Context/Constraints: Minimize data joins and use proper keys.
Desired Output Format: Optimized query code.
๐งพ 8️⃣ ENUM & ENUM EXTENSION PROMPTS
36. Create Enum
Role Assignment: Act as AL Enum designer.
Task/Goal: Define Enum “Customer Segment” with values Gold, Silver, Bronze.
Context/Constraints: Extensible = true.
Desired Output Format: AL Enum code.
37. Extend Existing Enum
Role Assignment: Act as AL extensibility expert.
Task/Goal: Extend “Document Type” Enum to add “Advance Invoice”.
Context/Constraints: EnumExtension = true.
Desired Output Format: EnumExtension code.
38. Enum Usage in Page
Role Assignment: Act as UI developer.
Task/Goal: Use Enum field on Card page.
Context/Constraints: Enum = “Customer Segment”.
Desired Output Format: AL page snippet.
39. Enum to Option Migration
Role Assignment: Act as modernization expert.
Task/Goal: Convert existing Option field to Enum.
Context/Constraints: Keep backward compatibility.
Desired Output Format: Migration code.
40. Enum Caption Localization
Role Assignment: Act as localization engineer.
Task/Goal: Add translated captions for Enum values.
Context/Constraints: Include ENU and DEU examples.
Desired Output Format: Enum AL code with translations.
๐งฎ 9️⃣ PERMISSIONS, INTERFACE, ROLE CENTER
41. Create PermissionSet
Role Assignment: Act as security specialist.
Task/Goal: Create PermissionSet “SALES_TARGET_EDIT”.
Context/Constraints: Grant insert/modify to Sales Target table.
Desired Output Format: AL PermissionSet code.
42. Create Interface
Role Assignment: Act as abstraction layer designer.
Task/Goal: Define Interface “IExpenseProcessor”.
Context/Constraints: Include Validate, Post, Notify methods.
Desired Output Format: AL interface code.
43. Implement Interface
Role Assignment: Act as polymorphism expert.
Task/Goal: Implement IExpenseProcessor in a concrete codeunit.
Context/Constraints: Implement all defined methods.
Desired Output Format: AL codeunit.
44. Role Center Design
Role Assignment: Act as UI architect.
Task/Goal: Create RoleCenter for “Sales Manager”.
Context/Constraints: Include Cues for Orders, Invoices, Customers.
Desired Output Format: AL RoleCenter code.
45. Add Activity Page
Role Assignment: Act as productivity dashboard designer.
Task/Goal: Add Activity Page for Sales metrics.
Context/Constraints: Combine queries + charts.
Desired Output Format: Page + Cue code.
๐ก ๐ ADVANCED SCENARIOS (DEVOPS + UTILITIES)
46. Data Upgrade Codeunit
Role Assignment: Act as version migration expert.
Task/Goal: Write OnUpgradePerCompany() to migrate data v1→v2.
Context/Constraints: Preserve key fields.
Desired Output Format: AL codeunit.
47. CSV Import Tool
Role Assignment: Act as data migration expert.
Task/Goal: Import CSV data into custom table.
Context/Constraints: Use FileManagement codeunit.
Desired Output Format: AL codeunit.
48. Telemetry Log Integration
Role Assignment: Act as telemetry developer.
Task/Goal: Log custom telemetry when posting orders.
Context/Constraints: Use Session.LogMessage().
Desired Output Format: AL code snippet.
49. Error Handling Template
Role Assignment: Act as error handling specialist.
Task/Goal: Create TRY-CATCH wrapper for API calls.
Context/Constraints: Show message and store error in log table.
Desired Output Format: AL function code.
50. AI-Driven Suggestion API
Role Assignment: Act as AI integration engineer.
Task/Goal: Create codeunit calling external AI API to suggest discount % for customer.
Context/Constraints: Use HttpClient and JSON handling.
Desired Output Format: AL codeunit example.
Write below text last line of Prompt :
"As a prompt engineer, please review and refine the following prompt. My goal is to achieve more accurate and high-quality results. Feel free to ask any clarifying questions before you start."
Review the following prompt for , optimize it for more accuracy, and ask me any questions before processing (Assume the role of a prompt engineer and review the following prompt for , optimize it for better results)
Please review the following prompt for , optimize it for better results, and ask me any questions before processing. (Assume the role of a prompt engineer and review the following prompt for , optimize it for better results.)
As a prompt engineer, please review and refine this prompt to ensure greater accuracy, quality, and efficiency. Feel free to ask any clarifying questions before you start
Act as a prompt engineer. Review the prompt between the delimiters, identify issues (ambiguity, missing context, conflicting instructions), ask necessary clarifying questions first, then provide an optimized prompt that preserves intent, improves structure, and specifies output format and constraints.
No comments:
Post a Comment