Tag Archives: D365 FO

D365 FO/AX7: Cross-company & Change-company for accessing Data for Multiple Companies Using X++

Introduction

In Microsoft Dynamics AX/D365 Finance and operation, users can setup multiple legal entities. By default in Microsoft Dynamics AX/D365 FO, all tables store data per company unless SaveDataPerCompany  property is not changed to NO. By dafault value of property SaveDataPerCompany  = Yes.Using crosscompany & changecompany keyword, you can construct a query to retrieve all records, regardless of the company you are currently logged into.You can fetch the all the company records using keyword -crosscompany and function – changecompany.

Change-Company

static void main()
{
  CustTable custTable;
  changeCompany('INMF') 
  {
    custTable = null;
    while select custTable
    {
       //custTable of company 'INMF'.
    }
  }
}

Cross-Company

static void main()
{
  CustTable custTable;
  while select crosscompany custTable
  {
      custTable of all the companies
  }
}

D365/AX7: Edit Method In Table Extension Of Standard or Base Table or Custom Table

In past, i explained D365/AX7:Display Method In Table Extension Of Standard or Base Table. Display method value cannot be edited but in Edit Method users can edit the value.

Sample Code

Add the below method in extension class of table and use the same in Form Control .

edit int largeDescriptionEdit(boolean _set, Description _largeDescription)
{
	AcxBankAccountTable acxBankAccountTable;
	int  ret;

	acxBankAccountTable = AcxBankAccountTable::find(this.Name, _set);

	if (_set)
	{
		ttsbegin;

		acxBankAccountTable.LargeDescription = _largeDescription;
		acxBankAccountTable.update();

		ttscommit;
	}
	else
	{
		ret = acxBankAccountTable.LargeDescription;
	}

	return ret;
}

D365/AX7: Uninstall/Remove a Model/Package From Production & UAT Environment

Requirement

Uninstall/Remove a Model/Package From Production & UAT Environment of Microsoft Dynamics Finance and operations.

Steps

  1. Create a file that is named ModuleToRemove.txt.
  2. In the file, put the name of each module that you want to remove on a separate line. Make sure that you’ve completed the prerequisites for each module that you’re removing.
  3. Create a valid deployable package, and put the ModuleToRemove.txt file in the package\AOSService\Scripts folder.
  4. Install/Deploy the deployable package in UAT or production environment.
  5. Verify that the package was uninstalled before you complete this procedure in a production environment.

D365/AX7: Computed Column/Field In View Using Method & SQL Statements

Requirement

Adding a Computed Column/Field In View Using Method & SQL Statements.

Sample Code

  1. Add a new method “Computed” in your view.You can fully utilize SQL case statements, SQL Functions, SQL direct statements as per your requirements.Untitled
  2. Add a new string computed column or field in your view.Capture
  3. Change the property of computed column and select your method name in “View Method” property.Untitled
  4. Build and Synchronize the project.Your view is now ready to use.
  5. You SQL View should look like this.UntitledCheers …Piyush Adhikari

D365/AX7: Debug Batch Jobs In Visual Studio Using Process batch.exe

Requirement

There are many process in Microsoft Dynamics 365 Finance and Operation which run in background as a batch jobs. The Debugging of Batch Jobs In Visual Studio is very common requirement.

Steps

  1. Go the Debug Menu & Click on “Attach To Process”.Untitled
  2. Show process from all users should be selected  YES
  3. Attach To Value should be -Automatic: Managed (v4.6, v4.5, v4.0) code
  4. Select Process “Batch.exe” from available processes & run your batch job. Breakpoint will hit and you will be able to debug your code.Untitled

D365/AX7:The configuration key on the data entity ‘XXXXX’ is disabled. The tables and fields in the data entity will not be available for use in data management

Issue

The configuration key on the data entity ‘XXXXX’ is disabled. The tables and fields in the data entity will not be available for use in data management.

Observation

Data import/export framework requires entity list is up-to-date. Refresh of Entity list is pending.

Resolution

  1. Go to Workspaces
  2. Select Data Management
  3. Open “Framework parameters”
  4. Under “Data import/export framework parameters”, select fast tab “Entity Settings” and click on “Refresh Entity List”