Showing posts with label Copilot. Show all posts
Showing posts with label Copilot. Show all posts

January 26, 2026

Practical Ways to Use GitHub Copilot for X++ Development (Tips, Tricks, Hidden Gems & What to Avoid)

Hi Folks, 

In my last post about GitHub Copilot we covered what GitHub Copilot is, how to enable it, and the licensing options, let’s move into the part everyone actually cares about — Practical Ways to Use GitHub Copilot for X++ Development

Copilot isn’t magic, but when used well, it feels pretty close. Below are practical examples, prompt ideas, best practices, and a few “don’ts” that will save you time and frustration.

1. X++ Boilerplate Generation (Your New Time Saver)

X++ is full of repetitive patterns — table methods, service classes, form event handlers, data entities, and more. Copilot can generate 60–80% of this instantly.

Try prompts like:

  • “Create a validateWrite method for this table following best practices.”
  • “Generate a runnable class that updates sales orders with status ‘Open’.”
  • “Create a SysOperation framework class with contract, controller, and service.”

You still review and refine — but the heavy lifting is done. (I would still recommend this to do every single time)

2. Documentation & XML Comments (The Most Underrated Feature)

Copilot is brilliant at generating XML documentation for methods, classes, and services.

Prompt idea:

  • “Add XML documentation to this method explaining parameters and return values.”

Why it matters

  • Better readability
  • Faster onboarding for new developers
  • Cleaner code reviews

3. OData & Integration Summaries

When working with integrations, Copilot can help you quickly draft:

  • OData endpoint descriptions
  • Request/response examples
  • Error-handling notes
  • API documentation

Prompt idea:

  • “Explain how this data entity will behave when called via OData.”

This is especially useful when writing technical design documents.

4. Best Practice Suggestions on Selected Code

This is where Copilot becomes a mini code reviewer.

Highlight a block of X++ code → open Inline Chat (Alt + /) → ask:

  • “Suggest best practices for this code.”
  • “Is there any performance issue here?”
  • “Rewrite this using recommended patterns.”

Example: Summarize Sales Order

Your example:

public void summarizeSalesOrder(str salesOrderId)

{

    SalesTable salesTable = SalesTable::find(salesOrderId);

    info(strFmt("Sales Order %1 for customer %2 has total amount %3",

        salesTable.SalesId, salesTable.CustAccount, salesTable.TotalAmount));

}

Copilot might suggest:

  • Add null checks
  • Use ttsbegin/ttscommit if modifying data
  • Avoid info() in production code
  • Consider using SalesTotals class for accurate totals

This is where Copilot shines — it nudges you toward better patterns.

5. Plugin Development with Copilot Studio

If you’re building Copilot plugins for D365FO, Copilot can help with:

  • API schema generation
  • JSON payload examples
  • C# wrapper classes
  • Error-handling templates

This is still evolving, but it’s already a huge productivity boost.

6. Hidden Gems Most Developers Miss

  •       Use #filename to give Copilot context

Example:

#SalesTable Explain how validateWrite works for this table.

  • ü      Use /intent to guide Copilot

Example:

/refactor Rewrite this method to improve readability.

  • ü  Keep related files open

Copilot reads open tabs to understand your project structure.

  • ü  Use natural language

You don’t need to be formal.
“Make this faster” works surprisingly well.

7. What NOT to Do with Copilot (Important!)

Copilot is powerful, but not perfect. Avoid:

Blindly accepting code

Always review for:

  • Security issues
  • Performance problems
  • Deprecated APIs

Using Copilot for business logic decisions

Copilot doesn’t know your customer’s requirements.

Expecting Copilot to understand custom frameworks

It learns from your codebase over time — but not instantly.

Using vague prompts

“Fix this” → not helpful
“Optimize this query to reduce DB calls” → much better

While all this working magically, GitHub Copilot won’t replace your X++ expertise — but it will absolutely amplify it. So don't afraid of using it, make this your companion. The more you use it, the better it understands your patterns, naming conventions, and coding style.


-Harry 
 Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

August 22, 2025

Github copilot for D365FO development

Hi Folks, 

GitHub Copilot is transforming how developers write code. For those working with Dynamics 365 Finance and Operations (D365FO) in Visual Studio, Copilot can be a powerful assistant—helping with boilerplate code, documentation, and even plugin development. In today’s post let’s understand all about GitHub Copilot and how this can make your day-to-day development experience awesome.

Licensing & Pricing

First thing first, Lets understand

Ø  How much will it cost me?

Ø  What all licenses are there?

Ø  What license do I need to use?

(One more license to buy 😊)

GitHub Copilot offers several tiers:
- Copilot Free: $0 - Limited completions and chat (2,000 completions, 50 chats/month)
- Copilot Pro: $10 - Unlimited completions and chat, access to GPT-4o
- Copilot Business: $19/user - Team management, advanced features
- Copilot Enterprise: $39/user - Enterprise-grade AI features and integrations

(Official Pricing Guide for more information)

How to Enable GitHub Copilot in Visual Studio

To install Copilot in Visual Studio 2022 (v17.10+):
1. Open Visual Studio Installer
2. Select your installed version → Click Modify
3. Choose any workload (e.g., .NET desktop development)
4. Under Optional Components, check GitHub Copilot
5. Click Modify to install

Sign in with your GitHub account

Another option could be , on the top right corner you will get the option to login with Github Copilot




Here is detailed Installation Guide

Copilot for D365FO Development

Copilot can assist with many things, below are some areas which I explored so far,
- X++ boilerplate generation
- Documentation comments
- Plugin development using Copilot Studio
- OData integration summaries

Give suggestion on best practice on selected object or selected piece of code.

Example: Summarize Sales Order in X++

public void summarizeSalesOrder(str salesOrderId)
{
    SalesTable salesTable = SalesTable::find(salesOrderId);
    info(strFmt("Sales Order %1 for customer %2 has total amount %3",
        salesTable.SalesId, salesTable.CustAccount, salesTable.TotalAmount));
}

Best Practices (From Microsoft Learn)

Here are some tips to maximize Copilot’s effectiveness:
- Use clear comments to guide Copilot
- Keep relevant files open—Copilot uses them to infer context
- Use Inline Chat (Alt + /)
- Refer to files using #filename or /intent
- Always review suggestions for accuracy and security
Copilot Fundamentals: https://learn.microsoft.com/en-us/training/paths/copilot/
Prompt Engineering Module: https://learn.microsoft.com/en-us/training/modules/introduction-prompt-engineering-with-github-copilot/


-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta