.value() remain the standard pattern in current Dynamics 365 Finance & Operations. The only thing that has moved on since 2021 is the development environment behind the "Build / Start" steps: Microsoft now uses a cloud-based Unified Developer Environment (UDE) provisioned via the Power Platform admin center, replacing the Lifecycle Services developer VMs, with build and run happening from Visual Studio 2022. See Unified environment types and templates for finance and operations apps.We made it! In the final post of our series, we will be making our calculator functional.
Adding Functionality with X++ Programming
1. Click on the "Multiply" button to unfurl and right-click on Methods. Select Override and click "clicked".
OverrideExample.png
2. Add the following code to the newly opened function.
Before the function, declare an int variable to hold the result of our calculations.
int result;
Use the newly created variable to create the correct equation.
result = Integer1.value() * Integer2.value();
Then pass the result variable to the Total field like this:
Total.value(result)
MultiplyCodeExample.png
3. Copy and paste the above code three more times into the .xpp file, making sure to change the name and operator (*, /,+,-) to match. You should end up with one function for each of the following: Multiply, Divide, Add, Subtract.
Code.png
4. In the Solution Explorer, right-click on the calculator form and click on "Set as Startup Object".
StartupObj.png
5. In the toolbar, select Build and click Build Solution.
BuildSolution.png
6. In the action pane, click on "Start". A new browser window should open with your calculator.
Start.png
7. Put a value in each of the top two fields and click on your calculator buttons to test. If everything goes as planned, you should now have a functional calculator!
(Special thanks to the Ali Mahar YouTube page for the inspiration for this series.)
Caf2Code is a Microsoft Solutions Partner specializing in Dynamics 365 Finance & Operations, Power Platform, and Power BI. Originally published July 16, 2021; restored to caf2code.com in 2026.