Thursday, March 23, 2023

X++ job(runnable class) to loop through all tables in AOT - D365 F&O

 Hello DAXPeople,

Today we are going to see, how all the tables in AOT can be fetched using some standard framework.

The below code snippet will be having two AOT objects.

  1. Runnable class (GetAOTTablesList) : This class will have main business logic to loop through AOT tables                                                                                                                                               
  2. Table (AOTTablesList) : This table will be used to store the Table Label, Name, ID, Group and ConfigurationName.

Here is the code snippet written on Runnable class: GetAOTTablesList-

internal final class GetAOTTablesList
{
    /// <summary>
    /// Class entry point. The system will call this method when a designated menu 
    /// is selected or when execution starts and this class is set as the startup class.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        AOTTablesList    tablesList;
        System.Collections.IEnumerator tableCollectionEnumerator;
     
        delete_from tablesList;

        ttsbegin;
 
        var query = Microsoft.Dynamics.AX.Metadata.NodeLib.Specialized.TableQuery::Construct();

        query.AllowTemporary = false;
        query.AllowSystem    = true;

        tableCollectionEnumerator = query.GetEnumerator();
                            
        while (tableCollectionEnumerator.MoveNext())
        {
            GetAOTTablesList::createTableRefRecord(tableCollectionEnumerator.Current as Microsoft.Dynamics.AX.Metadata.NodeLib.Node);
        }

        ttscommit;
    }

    internal static void createTableRefRecord(Microsoft.Dynamics.AX.Metadata.NodeLib.Node _node)
    {
        AOTTablesList    tablesList;
        SysDictTable            dictTable           = new SysDictTable(tableName2Id(_node.Name));
        tableId                 tableId             = dictTable.id();
        
        if (dictTable && dictTable.enabled())
        {
            // don't include views, temp tables, in memory tables, dixf staging tables, transaction, dataentity
            if ( DictTable.isView() || dictTable.tableType() != TableType::Regular || dictTable.tableGroup() == TableGroup::Staging
                || dictTable.tableGroup() == TableGroup::Transaction || dictTable.isDataEntity())
            {
                return;
            }

            tablesList.TableIdValue       = tableId;
            tablesList.TableObjectName    = dictTable.name();
            tablesList.TableLabel         = dictTable.label();
            tablesList.TableGroup         = dictTable.tableGroup();
            tablesList.ConfigName         = configurationkeyId2pName(dictTable.configurationKeyId());

            tablesList.insert();
        }
    }

}

Refer below the Table structure  & Fields:



At the end, if you want to execute the runnable job, create an Action menu item and add it to your custom module or any existing module.

After adding the menu item button, click on it.

Job will then be executed and you will be able to see records getting created in the table.

Here is the output of job execution.



Happy Daxing.. !!





Wednesday, March 15, 2023

Installation & Configuration of RSAT tool in Tier 1 Environment

Hello DaxPeople,

Today we are going to have a walkthrough on how to install and configure RSAT (Regression suite automation tool ) in Tier 1 environment.

Installation:

  1.  Navigate to the below URL to download RSAT .msi file https://www.microsoft.com/download/details.aspx?id=57357                                                           
  2.   Post download, run the file and click on install.                                                                                               
  3.  Part of installation it may ask to download and install Selenium and chrome driver. Click on Yes to install them.                                                                                                        
Configuration: 
  1. Navigate to desktop and find RSAT tool shortcut with name : Regression Suite Automation Tool.                                                                                                                
  2.  Double click and navigate to settings tab(refer below image)                                            
As shown in below image: We have different sections and for each section we need to provide inputs and perform test connection.   
                                              

     Section 1: Azure Devops:
             
            1. Azure devops url : https://<YourDevopsOrg>.visualstudio.com

            2. Access Token : It is generated by system admin who has full access to Azure devops. To generate a new access token, need to navigate to portal.azure.com --> Settings --> Access token.

            3. Project name : It is a lookup and by default the project name is visible when you connect to azure devops.

            4. Test plan : It is also a lookup and comes from the project name.

      Once above details have been provided, test connection button will ensure the input data correctness.
      When you click on that button, it will show below message.


             
       Section 2: Finance and Operations Test Environment:
  1.       Hostname: <D365 F&O Url without https>.cloudax.dynamics.com                                    
  2.       SOAP Hostname: <D365 F&O Url>soap.cloudax.dynamics.com                                      
  3.     Admin username: Any user added in System administration --> Users (With System administrator role assigned)                                                                                                 
  4.      Thumbprint: To generate a thumbprint, as we are dealing with Tier1 environment,        click on new button and it will automatically generate a thumbprint and the same will be added to trusted root certificates nodes in registry.

     Note: Copy the thumbprint number, it is required to change the config file(wif) of AOS service available under IIS manager portal. 

      To add thumbprint number to AOS service follow below steps.
  •     Navigate to Internet information services (IIS) manager and right click on AOSService (refer below image).

  •      Update wif.config file by adding another authority name (as shown below): 
                                    
                    
          <authority name="CN=127.0.0.1">

            <keys>

              <add thumbprint="<Copy the same Thumbprint generated when clicked on New>" />

            </keys>

            <validIssuers>

              <add name="CN=127.0.0.1" />

            </validIssuers>

          </authority>

            5. Company name: Legal entity name available in D365 F&O instance.

      Once above details have been provided, Test connection button will ensure input data correctness. When you click on that button, it will show below message.                                                                  

         
Section 3: Run settings

  1.      Working directory: Just create a local folder where all the RSAT files will be placed. By default, these are placed under C:\Users\RSAT.                                                                                         
  2.      Default browser: Provide either Microsoft edge/ Google chrome as browser


That's it folks. RSAT tool is now installed and configured. 

     Happy Daxing.. !!


    



Wednesday, March 16, 2022

Job to get current Application version and Product Version in Dynamics 365 F&O via front end and X++ code

 Hi Team,

Welcome to the blog. Today I would like to share the code snippet through which we can get the current Application version and Product Version in Dynamics 365 Finance and operations.

Note: Also these details can be accessed from the AX web client ( frontend) by clicking on "About".


Application and Product version



*********************************************************************************

class TogetCurrentApplicationAndProductVersion

{

    /// <summary>

    /// Runs the class with the specified arguments.

    /// </summary>

    /// <param name = "_args">The specified arguments.</param>

    public static void main(Args _args)

    {

        str productversion, Applicationversion, productApplicationversion;


        Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.ProductInfoProvider provider = Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.ProductInfoProvider::get_Provider();

        productVersion = provider.get_ApplicationVersion();

        Applicationversion = provider.ApplicationBuildVersion;

        

        productApplicationversion =(strFmt("%1(%2)", productVersion, Applicationversion));


        Info(   productApplicationversion);

    }


}

********************************************************************************

Happy Daxing.. !!