Skip to main content

πŸš€ How to Dynamically Copy Matching Fields Between Tables in X++ using DictTable

 In Microsoft Dynamics AX (X++), there are many scenarios where you need to duplicate data from one table to another—especially during custom import, duplication, or versioning processes. Traditionally, this is done by manually assigning each field: targetTable.Field1 = sourceTable.Field1; targetTable.Field2 = sourceTable.Field2; ... But what if the tables have many fields ? Or maybe you’re dealing with multiple similar table pairs? That’s where the powerful DictTable class comes in. Let’s walk through how to use it to copy matching fields dynamically between two tables. πŸ’‘ Use Case: Copy Customer Templates Let’s assume you have these tables: CustTemplateHeader – stores predefined customer templates. CustTemplateHeaderHistory – a historical copy of templates for versioning. You want to copy records from CustTemplateHeader to CustTemplateHeaderHistory , but only for fields that exist in both tables. ✅ The Solution Using DictTable SalesHeaderTemplate   ...

Configuring a Secure Connection to D365FO in OneBox

 Introduction

In this guide, we will address how to eliminate the “Not secure” message that appears in the URL bar when connecting to Dynamics 365 for Finance and Operations (D365FO) in a local development environment known as OneBox. We will explore why this issue arises and provide a step-by-step solution to fix it.

Understanding the Issue

The problem originates from the site certificate not meeting the latest security standards. Google Chrome, starting from version 58, uses only the subjectAlternativeName extension, not the commonName, to validate the domain name against the site certificate. This change means that if the certificate does not comply with these standards, Chrome will flag it as invalid. Although Internet Explorer (IE) is less strict and may not show this warning, the issue is significant for Chrome users. More information can be found at this link: Google Chrome Security Support.

Solution Steps

Step 1: Generate a New Self-Signed Certificate

To address this issue, you need to create a new self-signed certificate. Follow these steps:

  1. Open PowerShell as an Administrator.

  2. Run the following command:       

    New-SelfSignedCertificate -Subject "CN=*.cloud.onebox.dynamics.com,O=Microsoft Corporation,L=Redmond,S=WA,C=US" -DnsName "*.cloud.onebox.dynamics.com", "usnconeboxax1ecom.cloud.onebox.dynamics.com", "usnconeboxax1pos.cloud.onebox.dynamics.com", "usnconeboxax1ret.cloud.onebox.dynamics.com" -CertStoreLocation "cert:\LocalMachine\My" -KeyUsage DataEncipherment, KeyEncipherment, DigitalSignature -HashAlgorithm "SHA384" -KeyAlgorithm RSA -KeyLength 2048 -NotAfter (Get-Date).AddYears(5)


    This command generates a new certificate that is valid for 5 years. Alternatively, you can use the free Self-Signed Certificate Generator available online.

  3. Step 2: Copy the New Certificate to Trusted Root Certification Authorities

    1. Open the "Manage Computer Certificates" utility (certlm.msc).
    2. Locate the newly created certificate in the Personal\Certificates folder. This certificate will have a new expiration date compared to the old one.
    3. Copy this certificate and paste it into the Trusted Root Certification Authorities\Certificates folder.

    Step 3: Bind the New Certificate with D365FO

    1. Open Internet Information Services (IIS) Manager.
    2. Navigate to the AOSService site.
    3. Click on the Bindings link on the right-hand side.
    4. Select the appropriate hostname and click on the Edit button.
    5. In the Edit Site Binding dialog, open the SSL certificate drop-down menu.
    6. You will see two certificates with the name *.cloud.onebox.dynamics.com. Select the newly created certificate. Verify by clicking the View button to ensure it has the correct expiration date.
    7. Confirm any prompts to update the certificate for other related sites.

    Step 4: Restart the AOSService and Test the Connection

    1. Close all open dialogs and restart the AOSService. You can do this by clicking the Restart link under Manage Websites in the right-hand pane.
    2. Restart Google Chrome and navigate to D365FO.

    After completing these steps, your connection to D365FO should now be marked as secure in Chrome, eliminating the “Not secure” warning.

    By following this guide, you ensure that your development environment in OneBox adheres to modern security standards and provides a secure browsing experience.

Comments

Popular posts from this blog

How to Refresh a Form or Data Source in D365FO Using X++

  Introduction In Microsoft Dynamics 365 Finance & Operations (D365FO), refreshing the form after an action (like inserting, updating, or deleting a record) is essential for keeping the UI updated with the latest data. In this blog, we’ll explore two ways to refresh the form in X++: ✅ Refreshing the entire form using taskRefresh ✅ Refreshing a specific data source using research Let's dive into the best practices for implementing these refresh methods! πŸ”„ Refreshing the Entire Form If you need to refresh the whole form , use the taskRefresh method. This method is useful when multiple data sources are involved, and you want to reload everything. πŸ“Œ X++ Code for Full Form Refresh public void refreshForm() {     // Get the current form instance     FormRun formRun = this.formRun();     // Check if formRun is valid before refreshing     if (formRun)     {         info("Refreshing the form...");     ...

How to Open a Form with Filtered Data Using a Button in X++ – A Step-by-Step Guide

 In Dynamics 365 for Finance and Operations (D365FO), a common requirement is to open a form dynamically from another form and pass filtered data based on a specific condition. This functionality can enhance user experience by allowing them to interact with multiple forms seamlessly, while keeping the data relevant and focused. In this blog, we’ll explore how to implement such a solution using X++, where a user clicks a button on Form 1 (such as a list of sales orders), and based on a selected record, Form 2 (such as invoice details) opens with only the relevant filtered data. Scenario Overview Let’s assume the following scenario: Form 1 : Displays a list of sales orders, and each order has an OrderID , CustomerID , and OrderAmount . Form 2 : Displays details of invoices (from the InvoiceDetails table) that are linked to the selected OrderID from Form 1 . The goal is to click a button on Form 1 , pass the OrderID to Form 2 , and display only the relevant invoice records relate...

Sorting Data in X++ (D365FO) Grids Using Form Data Source Events

  Introduction : In Dynamics 365 Finance and Operations, form grids often display data retrieved from a table or query. However, the default sorting applied may not always align with business requirements. Customizing sorting behavior at runtime ensures that the grid data is presented in a meaningful order for users. This blog post demonstrates how to use the Initialized event of a form data source to apply custom sorting to a grid. We will sort the grid rows based on a specific field ( DisplayOrder ) in ascending order. Understanding the Code : Here’s the complete code snippet: --------------------------------------------------------------------------------------------------------------- [FormDataSourceEventHandler(formDataSourceStr(MyFormDataSource,  MyTable), FormDataSourceEventType::Initialized)] public static void MyFormDataSource_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e) {     // It will clear if any other sorting is applied on the grid ...