Prompt Review Business Central AL code

 Top 10 reusable prompts — Review Business Central AL code as a senior developer (with suggested fixes + code snippets)

Copy any prompt, paste your AL code where indicated, and send to the model. Each prompt follows the structure you asked: Role Assignment + Clear Task/Goal + Context/Constraints + Desired Output Format.

  1. Performance review — reduce DB calls
    Role Assignment: Act as a senior Business Central AL performance engineer.
    Task/Goal: Review the pasted AL code and identify places that cause excessive database reads/writes; propose changes to minimize I/O.
    Context/Constraints: Code runs on Sales Order processing for large datasets (100k+ lines). Avoid changing business logic; focus on batching, FindSet/Update, use of Temporary tables, and FlowFields.
    Desired Output Format: List of detected performance issues (numbered) + short explanation each + a corrected code snippet showing the hottest function refactored (before/after) and a brief benchmark plan to validate improvement.
    Placeholder: [PASTE AL CODE HERE]


  1. Eventing & extensibility review
    Role Assignment: Act as a senior AL architect specializing in events and extensibility.
    Task/Goal: Review the pasted code for hard-coded hooks and suggest how to expose IntegrationEvents/BusinessEvents to make it extensible without breaking changes.
    Context/Constraints: Target solution must support extensibility by partners and follow MS naming conventions and var/const patterns. Keep backward compatibility in mind.
    Desired Output Format: Identified rigidity points + recommended event publishers/subscribers with full AL event code snippets (publisher + example subscriber) and guidance where to place them (object & trigger).
    Placeholder: [PASTE AL CODE HERE]


  1. Error handling & user messaging
    Role Assignment: Act as a senior AL reliability engineer.
    Task/Goal: Review error handling in the pasted code and propose a robust TRY-CATCH strategy, consistent error messages, and error logging.
    Context/Constraints: Use GetLastErrorText(), store errors in a “Log Entries” table, and avoid exposing raw system exceptions to end users. Support multi-language captions.
    Desired Output Format: Short list of problems found + a standardized TRY-CATCH wrapper code snippet + example of how to log and present a friendly message to the user (before/after).
    Placeholder: [PASTE AL CODE HERE]


  1. Security & permission review
    Role Assignment: Act as a senior BC security/permissions specialist.
    Task/Goal: Review code for permission/security issues (sensitive data, direct SQL, misuse of CurrPage, functions callable by users) and recommend PermissionSet/Object-level controls.
    Context/Constraints: Target Business Central best practices; avoid runtime elevation; prefer PermissionSet definitions over role assumptions.
    Desired Output Format: List of security risks + recommended PermissionSet XML/AL snippet(s) + code changes to enforce checks (e.g., CurrUserHasPermission) with an example enforcement snippet.
    Placeholder: [PASTE AL CODE HERE]


  1. Code quality & maintainability review
    Role Assignment: Act as a senior AL code-quality lead.
    Task/Goal: Review pasted code for naming, single-responsibility, duplication, and adherence to AL style rules; produce refactoring suggestions.
    Context/Constraints: Keep public APIs stable; prefer small, testable procedures; follow camelCase for locals and PascalCase for procedures.
    Desired Output Format: Priority-ranked list of refactors + one example refactor transforming a large procedure into 2–3 small procedures with full before/after AL code snippets.
    Placeholder: [PASTE AL CODE HERE]


  1. Unit testing & testability review
    Role Assignment: Act as a senior AL testing engineer.
    Task/Goal: Evaluate the pasted code for testability; suggest unit tests and mocks; provide test codeunits.
    Context/Constraints: Use the AL Test Framework (TestToolKit patterns), isolate tests per company, avoid external dependencies in tests.
    Desired Output Format: Problems preventing testability + 2–3 unit test codeunits (Arrange/Act/Assert) that target key logic + suggestions for required refactors to enable tests.
    Placeholder: [PASTE AL CODE HERE]


  1. Concurrency & Job Queue safety review
    Role Assignment: Act as a senior AL concurrency/operations engineer.
    Task/Goal: Review code for concurrency issues (deadlocks, race conditions) and propose Job Queue or locking patterns.
    Context/Constraints: Code runs in multi-user environment; some functions are executed by Job Queue concurrently; preserve idempotency.
    Desired Output Format: Detected concurrency risks + recommended locking or optimistic concurrency changes + example AL pattern using Record.LockTable / Job Queue-safe code snippet.
    Placeholder: [PASTE AL CODE HERE]


  1. Integration / API reliability review
    Role Assignment: Act as a senior AL integration architect.
    Task/Goal: Review REST/HttpClient or JSON handling in the pasted code. Suggest improvements for retries, timeouts, JSON parsing, and secure credential handling.
    Context/Constraints: Use HttpClient, JsonObject, secure storage for keys (Azure Key Vault or BC Credential Management), implement exponential backoff for retries.
    Desired Output Format: Identified fragilities + hardened HttpClient wrapper code snippet showing retry/backoff + secure key retrieval example + parsing error handling snippet.
    Placeholder: [PASTE AL CODE HERE]


  1. Upgrade & data migration review
    Role Assignment: Act as a senior AL upgrade/migration engineer.
    Task/Goal: Review the pasted upgrade/codeunit or migration logic; propose an OnUpgradePerCompany plan that is idempotent and safe for large datasets.
    Context/Constraints: Support rollback-friendly steps, progress logging, batch processing for millions of rows, and compatibility with older versions.
    Desired Output Format: Step-by-step upgrade plan + AL upgrade codeunit sample performing safe batched migrations (with checkpoints) and logging.
    Placeholder: [PASTE AL CODE HERE]


  1. UI/UX & page performance review
    Role Assignment: Act as a senior AL UI/UX engineer.
    Task/Goal: Review Page/PageExtension code for usability and performance (too many FlowFields, heavy OnOpenPage logic). Provide improvements.
    Context/Constraints: Keep ApplicationArea and ToolTips; minimize synchronous long-running logic on page open; use FactBoxes or background jobs if needed.
    Desired Output Format: Usability issues (bulleted) + revised Page/PageExtension code snippet replacing heavy OnOpenPage with an async JobQueue call or optimizing FlowFields (before/after).
    Placeholder: [PASTE AL CODE HERE]

50 reusable prompts — Review, Universal Code Initiative (UCI), Best Practices & AI-optimized coding rules for Business Central AL


Prompt IDScenarioRole and Prompt Example (Hinglish/English)
1Naming Conventions ReviewAct as Senior BC AL Developer. Review this AL code for adherence to Universal Code Initiative (UCI) naming conventions. Suggest improvements and a corrected code snippet.
2Code Readability EnhancementAs Senior Developer, review this AL code focusing on readability and maintainability. Provide refactored code with comments.
3Performance Best PracticesActing as AL Performance Expert, analyze code for expensive loops and DB calls. Suggest best practice optimizations with code snippet improvements.
4Data Classification ComplianceAs Security Expert, check the code for proper data classification usage per Universal Code Initiative. Suggest fixes with examples.
5Error Handling & LoggingReview AL procedure for robust error handling aligned with best practices. Suggest enhanced try/catch and logging implementation with code example.
6Modular Code ReviewAnalyze AL code for modularity and single responsibility principle compliance. Suggest refactorings and provide example modular code parts.
7Event Handling EfficiencyReview event subscriber implementation for efficient event handling and avoidance of common pitfalls. Suggest refined code snippet.
8UI/UX Consistency CheckReview page extensions and UI modifications for consistency with Business Central UX guidelines. Provide improved AL UI code.
9Security & Permission ChecksValidate code for adequate permission and security checks before sensitive operations. Provide refactored secure code snippet.
10Unit Testability AssessmentEvaluate code structure for ease of unit testing. Suggest improvements and create sample unit test and refactored code.
11Inline Documentation QualityReview inline comments and XML documentation. Suggest improvements and show enhanced documented code.
12API Integration ConformanceAnalyze AL code integrating with external APIs for adherence to best practices and error handling. Propose improved API consuming code.
13Custom Error MessagesCheck clarity and user friendliness of error messages in AL code. Propose improved messages with examples.
14Localization SupportReview code for proper use of localization and labels. Provide improved localization-ready AL code snippet.
15Use of Constants and EnumerationsReview magic numbers and strings replaced appropriately with constants/enums. Suggest improvements and code examples.
16Deprecation and CompatibilityEvaluate code for deprecated calls and ensure compatibility with the latest BC versions. Suggest compliant code changes.
17Extension Upgrade ReadinessAssess code readiness for smooth upgrades and migration scenarios. Include improved upgrade-safe code snippets.
18Code Duplication EliminationIdentify duplicated code blocks. Suggest abstractions or functions to eliminate duplication with examples.
19Secure Data HandlingCheck encryption and secure handling of sensitive data fields. Provide improved secure handling code.
20Query OptimizationReview database queries and filter usage for optimization. Suggest better AL query syntax or code restructuring.
21Proper Use of Try FunctionsCheck use of Try functions for non-intrusive error handling. Suggest improvements and code examples.
22Meaningful Variable NamesReview for meaningful variable names. Suggest renaming to enhance clarity and provide before-after code snippet.
23Code Formatting StandardsCheck for consistent code formatting (indentation, spacing). Provide reformatted code snippet.
24User Permission SetsReview creation and use of user permission sets. Suggest best practice AL code for permission management.
25Batch Job SafetyEvaluate scheduling and batch jobs code for robustness. Propose safer code approaches with examples.
26Minimal Data ExposureCheck for exposure of only necessary data, avoiding oversharing. Suggest code to limit data exposure.
27Use of Code AnalyzersAssess the use of AL code analyzers. Suggest fixes for analyzer warnings and improved code style.
28Table Relation IntegrityReview table relation declaration for consistency and performance. Suggest improved relationship definitions.
29Deprecated Function ReplacementIdentify deprecated functions. Suggest modern equivalents with code samples.
30Meaningful Error LoggingReview logging strategy for error traceability. Improve log entries and provide better logging code.
31Refactor Long FunctionsFind overly long functions. Propose splitting into smaller, reusable functions with examples.
32Consistent Use of Page ControlsCheck page control usage for consistency and maintainability. Suggest code improvements.
33Proper Use of Temporary TablesReview temporary table usage in processing logic. Suggest best practices and improved code.
34Comprehensive Test CoverageEvaluate the codebase for unit test coverage. Suggest additional test cases and example tests.
35Proper Use of Recurring JobsReview scheduling of recurring jobs for business logic. Suggest improvements for reliability.
36Efficient Use of DataItem FiltersReview use of filters in reports. Suggest improvements for performance and clarity.
37Clear Separation of ConcernsAssess logical separation of UI, business logic, and data access layers. Suggest refactoring suggestions.
38Use of New AL Language FeaturesReview use of latest AL language features for efficiency and clarity. Suggest code upgrades.
39Localization-Friendly UICheck UI code for localization readiness. Suggest improvements for internationalization.
40Consistent Use of Data TypesVerify consistent application of appropriate data types. Suggest corrections where needed.
41Safe Codeunit InstancingReview codeunit usage for safe and optimal instancing practices. Provide improved usage examples.
42Minimize Cross-Table AccessIdentify and optimize excessive cross-table access patterns. Suggest improved data access patterns.
43Clear Function ResponsibilityReview functions for single responsibility. Suggest improvements with example function splits.
44Use of Interface and AbstractionCheck for use of interfaces and abstraction layers. Suggest adding these where appropriate.
45Security Roles-Related Code ReviewEvaluate code related to security roles and permissions. Suggest tightened security implementations.
46Dependency Injection UsageCheck for DI usage where applicable. Suggest code improvements to use dependency injection.
47Error Context ClarityReview error messages and logging for sufficient context. Provide clearer error handling code.
48Cleanup Resources ProperlyCheck code for proper cleanup of resources (e.g., restore cursor, reset temp tables). Provide improved snippets.
49Use of Modern Debugging PracticesSuggest use of modern AL debugging practices. Suggest code additions for logging and telemetry.
50Documentation CompletenessReview code comments and external documentation. Suggest adding missing documentation blocks with examples.

General code quality & architecture

  1. Role Assignment: Act as a senior Business Central AL architect and UCI reviewer.
    Task/Goal: Perform a full-code review of the pasted AL file for adherence to Universal Code Initiative (UCI) and AL best practices.
    Context/Constraints: Keep public API stable, don't alter business logic, mark breaking changes clearly.
    Desired Output Format: Numbered list of issues (severity), remediation suggestions, 2–3 before/after snippets for the most critical fixes, and a short risk/impact note.

  2. Role Assignment: Act as a senior AL refactoring expert.
    Task/Goal: Identify long procedures (>200 lines) and refactor suggestions to follow single-responsibility and modular design.
    Context/Constraints: Maintain original behavior; preserve variable names used externally.
    Desired Output Format: List of candidate procedures + concrete refactor split with before/after code snippets and suggested new procedure names.

  3. Role Assignment: Act as a SOLID and UCI specialist.
    Task/Goal: Review object for violations of SOLID principles and propose concrete code-level changes.
    Context/Constraints: Show how to separate concerns without changing external signatures.
    Desired Output Format: For each violation: explanation, proposed pattern (interface/codeunit split), and example AL code demonstrating the fix.

  4. Role Assignment: Act as a naming-standards reviewer.
    Task/Goal: Check naming for tables, variables, procedures, and constants against UCI naming rules and Microsoft AL conventions.
    Context/Constraints: Suggest consistent camelCase for locals, PascalCase for procedures, prefixes for globals.
    Desired Output Format: Table of problematic identifiers + suggested replacements + automated regex rules to find occurrences.

  5. Role Assignment: Act as a code-linter rules author (AL).
    Task/Goal: Generate a set of UCI/AI-friendly linting rules for AL (e.g., max procedure length, no magic numbers, explicit var/const).
    Context/Constraints: Rules must be actionable and automatable by a pre-commit tool.
    Desired Output Format: Enumerated lint rules + example violation and corrected snippet for each.


Performance & database I/O

  1. Role Assignment: Act as an AL performance engineer.
    Task/Goal: Find excessive DB reads/writes in pasted code and propose batching/temp table usage.
    Context/Constraints: Target large datasets (100k+ rows). Avoid changing final results.
    Desired Output Format: Hotspots list + optimized code snippet (FindSet/Update batching or use of Temporary table) + explanation of complexity reduction.

  2. Role Assignment: Act as an index and key advisor.
    Task/Goal: Review table usage and suggest key/index changes or FlowField alternatives to improve read performance.
    Context/Constraints: Include potential impact on writes and Explain how to update keys safely.
    Desired Output Format: Table of suggested key changes + AL table code snippet for key change + migration consideration notes.

  3. Role Assignment: Act as an AL caching expert.
    Task/Goal: Propose a caching strategy to reduce repetitive lookups in the pasted code.
    Context/Constraints: Use single-instance codeunit or in-memory temporary records; ensure cache invalidation.
    Desired Output Format: Cache implementation code snippet + invalidation rules and example usage.

  4. Role Assignment: Act as a FlowField optimization specialist.
    Task/Goal: Identify problematic FlowFields used in UI triggers and recommend precomputed alternatives or job-queue calculation.
    Context/Constraints: Minimize synchronous computation on page load.
    Desired Output Format: Example refactor from FlowField → stored aggregate + Job Queue code snippet to recalc.

  5. Role Assignment: Act as a memory & tempblob reviewer.
    Task/Goal: Audit code for heavy memory/tempblob usage and propose streaming or chunked processing alternatives.
    Context/Constraints: Target file imports and large JSON payloads.
    Desired Output Format: Problem summary + chunked processing AL snippet and recommended safe buffer sizes.


Events, extensibility & UCI patterns

  1. Role Assignment: Act as an event-design authority (UCI patterns).
    Task/Goal: Review the object for hard-coded extension points and propose IntegrationEvent/BusinessEvent publishers/subscribers to enable extensibility.
    Context/Constraints: Keep parameter VAR where appropriate; follow naming conventions OnBefore/OnAfter.
    Desired Output Format: Suggested event publishers + example publisher + example subscriber code.

  2. Role Assignment: Act as backward-compatibility reviewer.
    Task/Goal: Identify potential breaking changes and propose UCI-compatible extension points to avoid them.
    Context/Constraints: Provide migration path for existing consumers.
    Desired Output Format: List of breaking points + suggested non-breaking alternatives + sample event-based replacement snippet.

  3. Role Assignment: Act as an API contract guardian.
    Task/Goal: Verify exposed API pages/queries for stable field names and versioned contracts.
    Context/Constraints: Propose strategy for versioned API pages and deprecation headers.
    Desired Output Format: Versioning scheme + code snippet for API page v1 → v2 and deprecation notice.

  4. Role Assignment: Act as an UCI module interface designer.
    Task/Goal: Recommend modular boundaries and interfaces for the pasted extension (to make modules independently testable).
    Context/Constraints: Use AL interfaces and small codeunits.
    Desired Output Format: Proposed module map + interface AL code + sample implementation.

  5. Role Assignment: Act as an event conflict detection expert.
    Task/Goal: Detect situations where multiple subscribers may conflict and propose ordering or filter patterns.
    Context/Constraints: Preserve idempotency; avoid implicit side effects.
    Desired Output Format: Conflicting subscribers list + recommended subscriber filters/priorities + sample safe subscriber.


Error handling, logging & telemetry

  1. Role Assignment: Act as a reliability/UCI logging lead.
    Task/Goal: Review error handling and transform ad-hoc messages into standardized, localizable errors + structured telemetry.
    Context/Constraints: Use GetLastErrorText(), Session.LogMessage, and a custom Log table. Avoid exposing stack traces to users.
    Desired Output Format: Standard TRY/CATCH wrapper + logging codeunit snippet + sample log record schema.

  2. Role Assignment: Act as a telemetry optimization engineer.
    Task/Goal: Propose telemetry points to capture performance and business metrics in pasted code.
    Context/Constraints: Low overhead; GDPR-compliant (no PII).
    Desired Output Format: List of telemetry events + AL code to send Session.LogMessage + example event payload.

  3. Role Assignment: Act as an alerting & retry expert.
    Task/Goal: Add retry/backoff logic for external calls in the pasted code and alert rules for failures.
    Context/Constraints: Implement exponential backoff with max retries and logging.
    Desired Output Format: HttpClient wrapper code with retry/backoff + alerting log snippet.

  4. Role Assignment: Act as a localized message & UX reviewer.
    Task/Goal: Replace hard-coded English messages with resource captions and multi-language support.
    Context/Constraints: Provide ENU and one other language example.
    Desired Output Format: Example of Message/Err/Confirm replaced with Label and translations + AL resource snippet.

  5. Role Assignment: Act as an audit & compliance specialist.
    Task/Goal: Ensure actions are auditable (who/when/what) and add minimal audit logs for critical operations.
    Context/Constraints: Store minimal PII; fields must be DataClassification annotated.
    Desired Output Format: Audit table design + sample LogAction procedure + usage examples.


Security & permissions

  1. Role Assignment: Act as a BC security architect.
    Task/Goal: Review code for insecure patterns (hard-coded credentials, direct DB calls, elevation of privileges).
    Context/Constraints: Recommend secure storage and usage patterns.
    Desired Output Format: Risk list + secure alternative code snippets (Credential Management, Azure Key Vault example pseudo-code).

  2. Role Assignment: Act as a PermissionSet reviewer.
    Task/Goal: Generate minimal permission sets needed for new features in pasted code and highlight over-privileged operations.
    Context/Constraints: Follow least-privilege principle.
    Desired Output Format: PermissionSet AL object snippets + mapping of objects → required permissions.

  3. Role Assignment: Act as an input-sanitization expert.
    Task/Goal: Ensure external inputs (JSON, CSV, API payloads) are validated and sanitized before use.
    Context/Constraints: Provide defensive parsing patterns and schema checks.
    Desired Output Format: Validation helper code + JSON schema-like checks + example sanitization snippet.

  4. Role Assignment: Act as a secure integration specialist.
    Task/Goal: Review external API integration patterns in pasted code and enforce token handling/security best practices.
    Context/Constraints: Use secure storage for secrets, avoid logging tokens.
    Desired Output Format: Secure HttpClient usage snippet + token refresh and storage pattern.

  5. Role Assignment: Act as a data-classification & PII reviewer.
    Task/Goal: Identify PII fields and recommend DataClassification labels and access controls per UCI.
    Context/Constraints: Use Microsoft DataClassification categories.
    Desired Output Format: Annotated field list + AL snippet showing DataClassification attributes.


Testing, CI/CD & DevOps

  1. Role Assignment: Act as a unit-testing lead.
    Task/Goal: Propose unit tests for key functions in pasted code and provide test codeunits.
    Context/Constraints: Use AL Test Framework, isolate per company, and mock external dependencies.
    Desired Output Format: 2–3 AL test codeunits (Arrange/Act/Assert) + mock patterns.

  2. Role Assignment: Act as a testability refactorer.
    Task/Goal: Identify barriers to testability (static code, external calls inside logic) and refactor examples to enable mocking.
    Context/Constraints: Show before/after to allow unit tests without external resources.
    Desired Output Format: Refactor snippet + sample test consuming the refactored code.

  3. Role Assignment: Act as a CI/CD pipeline adviser for AL.
    Task/Goal: Provide a CI step checklist that enforces UCI rules (lint, unit tests, code coverage threshold, symbol validation).
    Context/Constraints: GitHub Actions / Azure DevOps friendly.
    Desired Output Format: YAML snippet outline + commands for checks.

  4. Role Assignment: Act as an automated release/versioning expert.
    Task/Goal: Propose a versioning scheme for app.json and pipeline automation to bump versions safely.
    Context/Constraints: Major.Minor.Patch with build metadata; preserve compatibility.
    Desired Output Format: PowerShell or YAML snippet to auto-increment version + guidelines.

  5. Role Assignment: Act as a build stability engineer.
    Task/Goal: Detect symbol dependencies and recommend ways to pin or resolve missing symbols during automated builds.
    Context/Constraints: Prefer symbols feed or explicit dependencies in pipeline.
    Desired Output Format: Troubleshooting steps + pipeline snippet to fetch symbols.


UI, pages, role centers & user experience

  1. Role Assignment: Act as a UX-focused senior AL dev.
    Task/Goal: Review Page / PageExtension code for usability and propose changes to improve flow and reduce cognitive load.
    Context/Constraints: Maintain existing fields; avoid heavy OnOpenPage logic.
    Desired Output Format: Bulleted UX issues + code snippets to refactor (FactBox, FastTabs, conditional visibility).

  2. Role Assignment: Act as a RoleCenter designer.
    Task/Goal: Suggest optimal Cues and KPIs for a given role and provide AL code for RoleCenter and Cues.
    Context/Constraints: Use performant queries and avoid FlowFields on RoleCenter.
    Desired Output Format: RoleCenter code + Query or Cue code snippet.

  3. Role Assignment: Act as an accessibility reviewer.
    Task/Goal: Ensure pages and captions are screen-reader friendly and labels are clear.
    Context/Constraints: Use concise captions and ToolTips; avoid ambiguity.
    Desired Output Format: List of accessibility issues + corrected Page snippet and caption examples.

  4. Role Assignment: Act as a page-performance optimizer.
    Task/Goal: Replace synchronous heavy OnOpenPage logic with Job Queue or background tasks.
    Context/Constraints: Provide sample Job Queue code; ensure user feedback for long tasks.
    Desired Output Format: Before/after Page code + Job Queue codeunit snippet.

  5. Role Assignment: Act as an inline-help/documentation engineer.
    Task/Goal: Add contextual help (ToolTips, HelpPage links) to critical fields and actions.
    Context/Constraints: Support multiple languages and short actionable text.
    Desired Output Format: Page extension snippet with ToolTips and Label entries.


Reporting, layouts & data export

  1. Role Assignment: Act as a report performance specialist.
    Task/Goal: Review report object or reportextension for inefficient dataset or grouping and propose improvements.
    Context/Constraints: Support large volumes and pagination where possible.
    Desired Output Format: Optimized report dataset snippet + advice on RDLC vs Word performance.

  2. Role Assignment: Act as a layout/localization reviewer.
    Task/Goal: Make RDLC/Word layout multi-language friendly and minimize layout rendering time.
    Context/Constraints: Keep layout simple and use aggregates where possible.
    Desired Output Format: Layout structuring guidance + sample dataset XML snippet.

  3. Role Assignment: Act as an export-data governance specialist.
    Task/Goal: Ensure CSV/Excel exports in pasted code handle encoding, large row counts and PII redaction.
    Context/Constraints: Stream rows and apply DataClassification rules.
    Desired Output Format: Streaming CSV export AL snippet + PII masking example.

  4. Role Assignment: Act as a scheduled-reporting expert.
    Task/Goal: Convert heavy on-demand report into scheduled Job Queue based report and provide code.
    Context/Constraints: Ensure deliverability (email/SFTP) and retry logic.
    Desired Output Format: Job Queue codeunit + report call snippet + delivery example.

  5. Role Assignment: Act as a dataset-compactness reviewer.
    Task/Goal: Reduce dataset size by selecting only needed fields and using summary items; recommend query usage.
    Context/Constraints: Balance between server-side aggregation and client needs.
    Desired Output Format: Proposed dataset fields list + AL Query or Report dataset snippet.


Integration, JSON, HttpClient & external APIs

  1. Role Assignment: Act as an API reliability architect.
    Task/Goal: Harden pasted HttpClient calls for retries, timeouts, and error classification.
    Context/Constraints: Use exponential backoff and circuit-breaker-like guards.
    Desired Output Format: Robust HttpClient wrapper AL snippet with retry/backoff and logging.

  2. Role Assignment: Act as a JSON robustness engineer.
    Task/Goal: Make JSON parsing resilient to schema changes and missing fields.
    Context/Constraints: Use JsonObject.TryGet and safe conversions.
    Desired Output Format: Safe JSON parsing AL snippet + example of tolerant mapping.

  3. Role Assignment: Act as OAuth/token lifecycle manager.
    Task/Goal: Provide secure token storage and refresh flow for an external API integration.
    Context/Constraints: Minimize exposure and avoid long-lived tokens in code.
    Desired Output Format: Token storage pattern + refresh snippet + secure retrieval code.

  4. Role Assignment: Act as a webhook and event sink expert.
    Task/Goal: Review webhook consumer logic and improve idempotency and dedup handling.
    Context/Constraints: Use unique message Ids and a dedup store table.
    Desired Output Format: Idempotent webhook handler AL snippet + dedup table design.

  5. Role Assignment: Act as a CSV/Import robustness expert.
    Task/Goal: Improve CSV import code to handle malformed rows, encoding issues and resume on failure.
    Context/Constraints: Batch processing with checkpointing.
    Desired Output Format: Robust import codeunit snippet with checkpointing and error log.


Upgrade, migration & versioning

  1. Role Assignment: Act as a UCI upgrade/migration lead.
    Task/Goal: Create an idempotent OnUpgradePerCompany plan for data transformations in the pasted upgrade code.
    Context/Constraints: Support resume on failure and batched execution for large tables.
    Desired Output Format: Upgrade codeunit snippet with batching, logging and checkpointing.

  2. Role Assignment: Act as a deprecation & obsoletion planner.
    Task/Goal: Propose safe deprecation strategy for fields/objects (ObsoleteState usage) and replacement path.
    Context/Constraints: Communicate to partners and keep backward compatibility for N releases.
    Desired Output Format: Obsoletion policy + sample ObsoleteState code + migration note.

  3. Role Assignment: Act as a semantic-versioning enforcer.
    Task/Goal: Map code changes to version increments (major/minor/patch) and produce app.json update guidance.
    Context/Constraints: Ensure compatibility guarantees are clearly documented.
    Desired Output Format: Versioning matrix + PowerShell snippet to update app.json.

  4. Role Assignment: Act as a large-data migration specialist.
    Task/Goal: Recommend patterns to migrate millions of records with minimal downtime.
    Context/Constraints: Use batched background jobs, back-out strategy and integrity checks.
    Desired Output Format: Stepwise migration plan + AL job queue snippet for batched migration.

  5. Role Assignment: Act as a release-readiness auditor.
    Task/Goal: Run a checklist-based review of the pasted extension for production readiness (UCI checklist: security, performance, tests, docs, telemetry, permissions).
    Context/Constraints: Provide pass/fail per item and remediation plan for failures.
    Desired Output Format: Checklist with status + prioritized remediation tasks + code snippets for critical fixes.

No comments:

Post a Comment