Skip to content

Commit

Permalink
Merge pull request #8667 from MicrosoftDocs/main
Browse files Browse the repository at this point in the history
Live push for Peter
  • Loading branch information
phecke committed Jun 7, 2024
2 parents 68bc70e + 34685c0 commit 7c1a439
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 124 deletions.
2 changes: 1 addition & 1 deletion power-platform/developer/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
href: appsource\appendix-add-license-information-to-your-solution.md
- name: Use Power Platform CLI with the catalog (preview)
href: submit-catalog-items.md
- name: Unified developer experience for finance and operations apps (preview)
- name: Unified developer experience for finance and operations apps
items:
- name: Overview
href: unified-experience\finance-operations-dev-overview.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
title: "Write, deploy, and debug X++ code"
description: "Learn how to write an X++ class, deploy it, and then debug it in the unified developer experience."
author: pvillads
ms.date: 08/21/2023
ms.date: 06/06/2024
ms.topic: how-to
ms.reviewer: phecke
ms.author: pvillads
ms.author: pathaku
ms.subservice: developer
---

# Write, deploy, and debug X++ code (preview)

[!INCLUDE [cc-beta-prerelease-disclaimer](../../includes/cc-beta-prerelease-disclaimer.md)]
# Write, deploy, and debug X++ code

The unified developer experience for finance and operation apps enables you to write code on your local development computer and run it inside a cloud service. There exists a separation of functionality between these two tiers (local and cloud).

Expand All @@ -26,7 +24,15 @@ This article shows you how to:

Let's begin by developing a runnable X++ class to use as an example. The class's only task is to log a message into the Infolog. The important thing here isn't what the runnable class does, rather it's how we compile, run, and debug it. If you want to learn about the X++ language, see the [programming reference](/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-language-reference).

As a prerequisite, you need to have completed setting up your local Visual Studio developer environment. More information: [Install and configure development tools (preview)](finance-operations-install-config-tools.md)
> [!IMPORTANT]
> You can learn more by watching presentation and demos done for the Dynamics 365 FastTrack Tech Talk series
>
>[Unified Development Experience for Finance and Operations | Dynamics 365 FastTrack Tech Talk](https://www.youtube.com/watch?v=OuEZ1rXkpYY)
## Prerequisites

You should have access to a unified developer environment, the Visual Studio tools extensions installed and configured on your developer machine and connected to the same environment. It's important to keep the metadata changes on your developer machine deployed to the connected environment .
More information: [Install and configure development tools](finance-operations-install-config-tools.md)

## Create a model

Expand All @@ -53,7 +59,7 @@ We start by creating a model in Visual Studio.
Create a project and X++ class in Visual Studio by following these steps.

1. Create a project in Visual Studio that contains the runnable class. The name of the class isn't important here. For this exercise, keep the default name that is FinanceOperations3.
1. Add a runnable class to the project in **Solution Explorer** by right-clicking the project and choosing **Add** > **New item**.
1. Add a runnable class to the project in **Solution Explorer** by right-clicking the project and choosing **Add** > **New item**.
1. Select a **Runnable Class** in the **Code** menu under **Dynamics 365 items**, and call it "MyRunnableClass". Visual Studio opens a window with the template for a runnable class providing a static `main` method that is called as the runnable class runs.
1. Add the following X++ code to the `main` method. Since we're only providing a token implementation here, add a call to log a string message in the Infolog:

Expand Down Expand Up @@ -81,18 +87,18 @@ At this point you're accessing the endpoint in the cloud, so unless you are alre

> [!IMPORTANT]
> There are different ways to deploy your changes to the unified development environment.
>
> 1. Deploy the full model via the **Dynamics 365** > **Deploy** > **Deploy models ...** dialog. You can choose to synchronize the database if so desired.
>
> 2. As part of a full build, deploy the full model. This deployment is initiated via the **Dynamics 365** > **Build models** dialog if the option to **Deploy to connected online environment** is turned on. The tool will synchronize database or not based on the **synchronize database** setting on the same **Options** tab.
> 1. Deploy the full model via the **Dynamics 365** > **Deploy** > **Deploy models ...** dialog. You can choose to synchronize the database if so desired.
>
> 2. As part of a full build, deploy the full model. This deployment is initiated via the **Dynamics 365** > **Build models** dialog if the option to **Deploy to connected online environment** is turned on. The tool will synchronize database or not based on the **synchronize database** setting on the same **Options** tab.
>
> 3. As part of an incremental build from Solution Explorer, setting **Deploy changes to online environment** to true will only deploy changes since the last successful deployment or those made as part of this build. It will honor the project settings for **Synchronize database**.
> 3. As part of an incremental build from Solution Explorer, setting **Deploy changes to online environment** to true will only deploy changes since the last successful deployment or those made as part of this build. It will honor the project settings for **Synchronize database**.
>
> 4. Right-click a project and choose to **Deploy model for project ...**. This will only deploy changes since last successful deployment but will not synchronize the database for the module.
> 4. Right-click a project and choose to **Deploy model for project ...**. This will only deploy changes since last successful deployment but will not synchronize the database for the module.
>
> 5. Synchronize the database for all models without deploying anything new via **Dynamics 365** > **Synchronize database...**.
> 5. Synchronize the database for all models without deploying anything new via **Dynamics 365** > **Synchronize database...**.
You can follow the progress of the deployment by navigating to the "FinOps Cloud Run-time" channel in the Visual Studio output window. Once that deployment is complete, you can see log information by following the link displayed in the output window.
You can follow the progress of the deployment by navigating to the "FinOps Cloud Runtime" drop down in the Visual Studio output window. Once that deployment is complete, you can see log information by following the link displayed in the output window.

## Debug the deployed code

Expand All @@ -116,7 +122,7 @@ Let's now try that. Instead of tediously writing our own form all over again, us

`https://<environment>?prt=initial&debug=vs&activityid=\<unchanged>&cmp=DAT&mi=SysUserSetup`

You'll now see the form that allows you to set the colors in Dynamic's open. <!--What are you meaning here-->
You'll now see the form that allows you to choose the colors.

Now let's set a breakpoint in the form.

Expand All @@ -125,7 +131,8 @@ Now let's set a breakpoint in the form.
1. Select the form, and select **View code** to open the editor with the source code for this form.
1. In that form, set a breakpoint in the `selectionChange` method in the ThemeChooser control. This code is triggered when the user selects a new color theme.
1. In the browser window, select one of the colored squares, let's say the red one. You'll hit the breakpoint.
1. Continue the execution by pressing F5. Another colored square is hit and the breakpoint is triggered again.
1. Continue the execution by pressing F10 or F5. Another colored square is hit and the breakpoint is triggered again.
1. You can watch the locals, set new breakpoints and do various debugging tasks.

> [!IMPORTANT]
> If you want to attach the debugger to the running AOS process in the unified environment use **Dynamics 365** > **Launch debugger**.
Expand All @@ -138,11 +145,13 @@ Now let's set a breakpoint in the form.

As a recap, here's a summary and the points to take away from this exercise.

We started with using Visual Studio to create a simple runnable class. After the compilation, the package needed to be pushed to the cloud endpoint for execution. X++ code can only be executed in the cloud, so we performed a deployment operation. Once the deployment was complete, we executed the code by setting a breakpoint and running the debugger. We then started a form from the browser, and noticed that breakpoints were hit correctly as the form was used, and we did'nt have to restart the debugger for that to happen. In fact, the debugger can be started by using the **Launch debugger** option on the **Extension** menu. You can then enter a URL in the browser and the breakpoints are hit.
We started with using Visual Studio to create a simple runnable class. After the compilation, the package needed to be pushed to the cloud endpoint for execution. X++ code can only be executed in the cloud, so we performed a deployment operation. Once the deployment was complete, we executed the code by setting a breakpoint and running the debugger. We then started a form from the browser, and noticed that breakpoints were hit correctly as the form was used, and we did not have to restart the debugger for that to happen. In fact, the debugger can be started by using the **Launch debugger** option on the **Extension** menu. You can then enter a URL in the browser, execute the scenario to debug and the breakpoints will be hit.

### See also

[Unit testing in the unified developer experience](finance-operations-testing.md)
[Unified Development Experience for Finance and Operations | Dynamics 365 FastTrack Tech Talk](https://www.youtube.com/watch?v=OuEZ1rXkpYY)

[Unit testing in the unified developer experience](finance-operations-testing.md)
[Create and manage environments in the Power Platform admin center](/power-platform/admin/create-environment)
[Manage Dynamics 365 apps](../../admin/manage-apps.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ ms.subservice: developer

# Unified developer experience for finance and operations apps

The unified developer experience consolidates the disparate developer tools and environments across finance and operations apps and Power Platform to reduce friction and simplify working across these apps. Finance and operations apps provide a rich ecosystem for professional developers by using a metadata and code-based development environment for mission critical scenarios. Power Platform brings the ability to author solutions quickly and seamlessly using low-code development paradigms and leverages Microsoft Dataverse as the relational data store. Power Platform also adds the ability to build and deploy your solutions using a continuous integration and deployment (CI/CD) pipeline.
The unified developer experience consolidates the disparate developer tools and environments across finance and operations apps and Power Platform. This reduces friction and simplifies working across these apps. Finance and operations apps provide a rich ecosystem for professional developers by using a metadata and code-based development environment for mission critical scenarios. Power Platform brings the ability to author solutions quickly and seamlessly using low-code development paradigms and uses Microsoft Dataverse as the relational data store. Power Platform also adds the ability to build and deploy your solutions using a continuous integration and deployment (CI/CD) pipeline.

## Typical scenario

Consider a typical scenario where a developer would create an app for capturing orders in Microsoft Power Apps and persisting the gathered data in Dataverse. By means of the data synchronization engines mentioned below, the data would be available for finance and operations apps to do the heavy lifting of determining whether the requested items are available and pricing, and more. The results would be available near real-time in Power Apps.
Consider a typical scenario where a developer would create an app for capturing orders in Microsoft Power Apps and persisting the gathered data in Dataverse. With the data synchronization engines mentioned below, the data would be available for finance and operations apps to do the heavy lifting of determining whether the requested items are available and pricing and more. The results would be available near real-time in Power Apps.

## Finance and operations app development

Development for finance and operations apps is accomplished in Visual Studio using the Visual Studio add-in. This development environment provides everything a professional developer would expect. The unified environment runs in the cloud, and because of that we have made several changes and improvements to the way a developer works with finance and operations apps. However, existing finance and operations app developers finds that the large majority of their workflows won't be different from what they're used to. The article [Write, deploy, and debug X++ code (preview)](finance-operations-debug.md) walks you through how to build X++ code, deploy it to the cloud, execute and debug it there. All other content that you're likely to find about finance and operations app development, like how to extend existing code, is likely to still hold true.
Development for finance and operations apps is accomplished in Visual Studio using the Visual Studio extension. This development environment provides everything a professional developer would expect. The unified environment runs in the cloud, and because of that we have made several changes and improvements to the way a developer works with finance and operations apps. However, existing finance and operations app developers will find that the large majority of their workflows will not be different from what they are used to. The article [Write, deploy, and debug X++ code](finance-operations-debug.md) walks you through how to build X++ code, deploy it to the cloud, execute and debug it there. All other content that you are likely to find about finance and operations app development, like how to extend existing code, is likely to still hold true.

More information: [Install and configure development tools](finance-operations-install-config-tools.md)

## Power Platform

Power Platform is supported by a rich development ecosystem. There's a rich set of tools in Power Platform that you can use for development. In particular, the Dataverse relational database management system is utilized by the unified developer experience. Many unified solutions work by synchronizing data between tables in the finance and operations app database and tables (entities) in Dataverse. There are two technologies for that: dual-write and virtual entities.
Power Platform is supported by a rich development ecosystem. There is a rich set of tools in Power Platform that you can use for development. In particular, the Dataverse relational database management system is utilized by the unified developer experience. Many unified solutions work by synchronizing data between tables in the finance and operations app database and tables (entities) in Dataverse. There are two technologies for that: dual-write, and virtual entities.

More information: [Microsoft Power Platform developer documentation](../index.yml)

Expand All @@ -50,11 +50,11 @@ Set up Visual Studio on your local development computer.
### See also

- [Install and configure development tools](finance-operations-install-config-tools.md)
- [Write, deploy, and debug X++ code](finance-operations-debug.md)
- [Frequently asked questions](finance-operations-faq.md)
- [Tutorial: Provision a new environment with an ERP-based template](../../admin/unified-experience/tutorial-deploy-new-environment-with-ERP-template.md#tutorial-provision-a-new-environment-with-an-erp-based-template)
- [Develop and customize home page](/dynamics365/fin-ops-core/dev-itpro/dev-tools/developer-home-page) (Dynamics 365 legacy information)
- [Unified admin experience for finance and operations apps](../../admin/unified-experience/finance-operations-apps-overview.md)
[Install and configure development tools](finance-operations-install-config-tools.md)
[Write, deploy, and debug X++ code](finance-operations-debug.md)
[Frequently asked questions](finance-operations-faq.md)
[Tutorial: Provision a new environment with an ERP-based template](../../admin/unified-experience/tutorial-deploy-new-environment-with-ERP-template.md)
[Develop and customize home page](/dynamics365/fin-ops-core/dev-itpro/dev-tools/developer-home-page) (Dynamics 365 legacy information)
[Unified admin experience for finance and operations apps](../../admin/unified-experience/finance-operations-apps-overview.md)

[!INCLUDE [footer-banner](../../includes/footer-banner.md)]
Loading

0 comments on commit 7c1a439

Please sign in to comment.