Thursday, July 30, 2026

Purchase Orders

 Before confirming a Purchase Order, the system should display a confirmation popup if the purchase order is associated with an active intercompany vendor.


[ExtensionOf(classStr(PurchFormLetter_PurchOrder))]

final class PurchFormLetter_PurchOrderClass_Extension

{

 public boolean validate(Object _calledFrom)

    {

        boolean ret = next validate(_calledFrom);


        if (ret)

        {

            PurchTable purchTable = this.purchTable();


            if (purchTable && InterCompanyValidationHelper::isPurchaseOrderWorkflowActive(purchTable))

            {

                ret = InterCompanyValidationHelper::validateVendor(

                    purchTable.OrderAccount);

            }

        }


        return ret;

    }

}


Helper class:-

public class InterCompanyValidationHelper

{

    public static boolean validateVendor(VendAccount _vendAccount)

    {

        VendTable                   vendTable;

        InterCompanyTradingPartner  tradingPartner;

        InterCompanyTradingRelation tradingRelation;

        LedgerParameters            ledgerParameters = LedgerParameters::find();


        if (ledgerParameters.VendInterCompany == NoYes::Yes)

        {

            if (!_vendAccount)

            {

                return true;

            }


            vendTable = VendTable::find(_vendAccount);


            if (!vendTable)

            {

                return true;

            }


            select firstOnly tradingPartner

                where tradingPartner.VendorParty      == vendTable.Party

                   && tradingPartner.VendorDataAreaId == vendTable.DataAreaId;


            if (tradingPartner)

            {

                select firstOnly tradingRelation

                    where tradingRelation.InterCompanyTradingVendor == tradingPartner.RecId

                       && tradingRelation.Active == NoYes::Yes;


                if (tradingRelation)

                {

                    if (Box::yesNo(

                        "You are trying to post a transaction for an intercompany vendor. Do you want to continue?",

                        DialogButton::No) == DialogButton::No)

                    {

                        return false;

                    }

                }

            }

        }


        return true;

    }

}

purchase order submit time through any validation or popup use this class :-PurchTableWorkflow

[ExtensionOf(classStr(PurchTableWorkflow))]

public final class PurchTableWorkflow_Extension

{

protected boolean canSubmit(PurchTable _purchTable)

{

    boolean ret = next canSubmit(_purchTable);


    if (ret)

    {

        ret = InterCompanyValidationHelper::validateVendor(_purchTable.OrderAccount);

    }


    return ret;

}

}

WorkFlow

My requirement is to validate the data before submitting the workflow. Currently, the validation error message is displayed in the workflow dialog, but I need it to be displayed on the master form before the workflow submission dialog opens.


public class WorkflowSubmitManager

{

    WorkflowComment      workflowComment;

    WorkflowVersionTable workflowVersionTable;

    boolean              bypassDialog;

    boolean              canceledAction;


    #define.BypassDialog('BypassDialog')


    public static WorkflowSubmitManager construct()

    {

        return new WorkflowSubmitManager();

    }


    public WorkflowComment parmWorkflowComment(

        WorkflowComment _workflowComment = workflowComment)

    {

        workflowComment = _workflowComment;

        return workflowComment;

    }


    public boolean parmBypassDialog(boolean _bypassDialog = bypassDialog)

    {

        bypassDialog = _bypassDialog;

        return bypassDialog;

    }


    public boolean parmCanceledAction(boolean _canceledAction = canceledAction)

    {

        canceledAction = _canceledAction;

        return canceledAction;

    }


    public boolean dialogOk(boolean _ok = false)

    {

        WorkflowSubmitDialog workflowSubmitDialog;


        if (!_ok)

        {

            workflowSubmitDialog = WorkflowSubmitDialog::construct(workflowVersionTable);

            workflowSubmitDialog.run();


            if (workflowSubmitDialog.parmIsClosedOK())

            {

                _ok = true;

                workflowComment = workflowSubmitDialog.parmWorkflowComment();

            }

            else

            {

                canceledAction = true;

            }

        }


        return _ok;

    }


    public boolean submitToWorkflow(Args _args)

    {

        Common callerRecord = _args.record();


        workflowVersionTable = Workflow::findWorkflowConfigToActivateForType(

            workFlowTypeStr(YourWorkflowType),

            callerRecord.RecId,

            callerRecord.TableId);


        Debug::assert(workflowVersionTable.RecId != 0);


        str callerParm = _args.parm();


        if (callerParm == #BypassDialog)

        {

            this.parmBypassDialog(true);

        }


        this.parmCanceledAction(false);


        if (this.dialogOk(bypassDialog))

        {

            Workflow::activateFromWorkflowConfigurationId(

                workflowVersionTable.ConfigurationId,

                callerRecord.RecId,

                this.parmWorkflowComment(),

                NoYes::No);

        }


        return true;

    }

Tuesday, April 21, 2026

Installing a New Package in D365 F&O Development Environment

 

Introduction

Installing and updating packages in the development environment is a common activity in Microsoft Dynamics 365 Finance. To ensure a smooth deployment, it’s important to properly remove old packages and install the new one without conflicts.

This blog explains the step-by-step process followed in a real-time development scenario.


Step-by-Step Process

Step 1: Verify the Package

  • Identify the package provided 
  • Note the exact package name to avoid confusion.

'' failed to upload. Invalid response: RpcError





Step 2: Remove Existing Package from Source Control

  • Go to the trunk/main branch.
  • Check if a package with the same name already exists.
  • If it exists, delete the package.



Step 3: Move Changes to Pending

  • After deletion, the package will appear under pending changes in source control.

Step 4: Check-In Changes

  • Check in the pending changes to the main branch.
  • This ensures the old package is completely removed from version control.

Step 5: Clean Local Package Directory

  • Restart IIS service.
  • Open Visual Studio → File Explorer.
  • Navigate to:

    K:\AosService\PackagesLocalDirectory
  • Delete the existing package folder manually.

This step ensures there are no leftover files from the old package.


Step 6: Download and Extract New Package

  • Download the new deployable package.
  • Extract it to a local folder (e.g., Downloads).

Step 7: Install the Package via Command Prompt

  • Open Command Prompt as Administrator.
  • Navigate to the extracted folder, for example:

    C:\Users\<YourUser>\Downloads\AXDeployablePackage_XXXX
  • Run the following command:

    AXUpdateInstaller.exe devinstall

Step 8: Monitor Installation

  • The installation process consists of multiple steps (usually 5 stages).
  • It may take some time to complete.
  • Wait until the process finishes successfully.

Step 9: Verify Package in Main Branch

  • After installation, the package will be available in the main branch.

Step 10: Check-In Final Changes

  • All updated files will appear under pending changes.
  • Review and check in the changes to the main branch.

Best Practices

  • Always remove the old package before installing a new one
  • Restart IIS to avoid caching issues
  • Clean the PackagesLocalDirectory to prevent conflicts
  • Verify pending changes before check-in
  • Ensure proper version control practices are followed

Conclusion

Proper package installation in Microsoft Dynamics 365 Finance requires careful handling of existing files, source control, and deployment steps. Following this structured approach helps avoid conflicts and ensures a smooth development experience.

Tuesday, February 17, 2026

JIT Access(Just In Time)

JIT access to TEST/UAT

Just-in-time access which is required for various troubleshooting efforts, running unplanned queries, or data upgrade problem solving.

Go to LCS and select the environment for which you wanted to connect the database. In my case, I am using TEST.

Enter the firewall by adding the IP address of the Dev VM from where the database will be connected.

Upon clicking Confirm, there will be a message which says about the expiry time of this firewall. Usually 8 hours.

The next step is accessing the database and the mode needed.

In the LCS page, under Database Accounts section, 4 options will be displayed for the accessing reason. As we are troubleshooting, we need write access and thus selecting ‘Troubleshooting tuning for AX”.

Select the reason and enter the details.

Click ‘Request Access’ and refresh the page. User will be presented with the login details .

Note down the details of SQL server, database name , user name and password.

These are needed when we connect the database from dev VM.

Refer Microsoft link for further information

Connect to Test Database

Now with the above credentials, connect to the TEST database and create a new login which will be used for debugging.

Use SQL Server authentication login(not Windows) to connect the database

Execute the below query which creates the new user used for debugging .

CREATE USER [axdevdebugadmin] WITH PASSWORD=N'Pass@word1', DEFAULT_SCHEMA=[dbo]
GO
EXEC sp_addrolemember N'db_owner', 'axdevdebugadmin'
GO

Web.Config changes:

Connect to the VM and navigate to the folder having ‘AOS Service’ -> WebRoot and select web.config file.

Take a copy of this file as we are going to modify some of the details in the file to connect the dev VM to TEST database.

Stop the following services :

IIS

World wide publishing

MS Dynamics 365 Batch

MS Dynamics 365 DIXF

Close the VS

Any active connection to local SQL db.

Right click on ‘Web.config’ file and open in Notepad. Make changes to the following tags.

<add key="DataAccess.Database" value="LCS JIT database name" />
<add key="DataAccess.DbServer" value="LCS JIT database server />
<add key="DataAccess.SqlUser" value="LCS JIT user name" />
<add key="DataAccess.SqlPwd" value="LCS JIT password" />
<add key="DataAccess.AxAdminSqlPwd" value="pass@word1" />
<add key="DataAccess.AxAdminSqlUser" value="axdevdebugadmin" />

Start the IIS and World wide publishing service.

Connect the Dev VM URL . You can check if it is accessing the test database by navigating to

System Administration -> Inquiries -> Database -> Database Information

Now the system is ready to start the debugging.

Tips and precautions while doing the process

  1. Make sure the VM and the higher environment are in the same version .
  2. Latest code in the VM where the debugging is triggered. Remove unwanted pending changes and do a buikd+sync in the VM before initiating the connection.
  3. It is always recommended to have the code base same in both the environments.
  4. Do not trigger database sync after connecting to TEST/UAT database .
  5. Take a copy of the web.config file before making the changes.
  6. Revert the changes once the debugging is finished. If left with the same web.config file , the URL will be inaccessible after 8 hours. Please note the JIT is alive only for 8 hours.
  7. If the database is refreshed within 8 hours, we need to generate a new JIT access.
  8. After connecting, please do not change the configuration








Wednesday, January 28, 2026

How to run Runnable class in Sandbox enviornment.

I created a runnable class, and it is working fine in the development environment. After that, I moved the class to the Tier-2 environment.

URL:-

https://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=USMF&mi=SysClassRunner&cls=ShowInvoicedOrderCount




Customization for Company ID in Assign Organization Form D365 in X++.

 Business Requirement Overview:

The organisation requires the Company ID to be visible along with the Company Name in the Assign Organisation form.
This enhancement will help users easily identify companies, especially when multiple companies have similar or identical names.

 

Scenario: Customise the company name with the company id

Customise the Assign Organisation form to display the Company ID along with the Company Name.

System administration>User>Assign Organisation

 

Current Behaviour:

·       The Assign Organisation form displays only the Company Name.

·       The Company ID is not visible to the user.

Required Behaviour:

·       The Company ID should be displayed along with the Company Name in the Assign Organisation form.

·       The display format should clearly identify both values.


Code:-

[ExtensionOf(FormStr(SysSecRoleAssignOM))]
internal final class SysSecRoleAssignOM_Extension
{
    public void fillTree()
    {
        next fillTree();
        CompanyInfo ci;
        OMHierarchyRelationship relationship;
        OMInternalOrganization  organization;
        boolean hasChildren;

        organizationTree.deleteAll();

        if (!hierarchyId)
        {
            while select Name, Dataarea,RecId from ci
            {
                SysFormTreeControl::addTreeItem(
                    organizationTree,
                    ci.Name + "- ("+ci.dataarea +")",
                    FormTreeAdd::Root,
                    ci.RecId,
                    this.getImage(ci.RecId),
                    false);
            }
        }
    }

}







Unable to find report design in D365 F&O X++

I am encountering an issue while opening a standard report. The error displayed is ‘Unable to find report design.

ERROR:-

At that time, the report was deployed using Windows PowerShell. After running the deployment command, the report opened successfully.

1. Open Windows PowerShell as a system administrator.




2. For deploying a specific SSRS report.

K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -ReportName YourReportName.Design name

3. For deploying all SSRS reports in a specific module.

K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -Module YourModuleName




Purchase Orders

 Before confirming a Purchase Order, the system should display a confirmation popup if the purchase order is associated with an active inter...