Version of Microsoft Dynamics AX: D365O

1. Selects

  • 1.1 Fetching data from all companies with crosscompany

Using intercompany functionality to fetch data from all companies at once, not just from the current company, as in the case with a regular select, use keyword crosscompany.

Picture1
  • 1.2 Fetching data from multiple companies with crosscompany

To select data not from all companies at once, but only from some of them, use keyword crosscompany and specified a list of companies:

  • option, where the list of companies is set in the container

Working with Intercompany functionality
  • option, where the list of companies is set in the where section

Working with Intercompany functionality
  • 1.3 Fetching data from one specified company with crosscompany

Another way to fetch data from a company other than the current company is to “switch” to another company using changecompany. In this case, all the code is executing in the context of the specified company.

Working with Intercompany functionality

Enhance your project delivery with OntargIT partner services

We are not a recruitment organization that just hires and resell resources. Instead we are service-oriented partner focusing on long term collaboration with customers and development of our teams. We obtain expertise which we’ve got by providing implementation consulting  to end customers for many years, and great team synergy we’ve built by doing so.

2. Forms data sources

  • 2.1 Displaying data from multiple companies

If you need to fetch data from multiple companies at the same time in the form data source, you need to change the value of property Cross Company Auto Query to «Yes». In this case, the data will be selecting from all existing companies.

Picture5

To limit the list of companies, you need it set the values of the required companies in the init() method of this data source.

Picture6
Picture7

3. Copying records

  • 3.1 Copying using buf2buf function

To copy a record from one company to another, you need to “switch” to the desired company using changecompany and initialize all the fields (except system fields) of the new record with buf2buf function.

Below is the code for a method that creates a new record and initializes its fields with the values of the original record:

Picture8

As an example of the standard buf2buf function using you can see the class CustFreeInvoiceCorrection.

Picture9
  • 3.2 Copying using a table data method and then adjusting the system fields

In cases where, for some reason, you to save the values of the system fields of the original record, except for field DataAreaId, since this field must in any case correspond to the company in which the new record is created, use the table data method.

At the same time, when creating a new record, some of the system fields can be overridden, and field DataAreaId must be overridden.

Overriding system fields must be allowed by special construction with using OverwriteSystemfieldsPermission().assert() и overwriteSystemfields().

Here is an example of code that overrides system fields in the new record.

Working with Intercompany functionality

4. Intercompany Sales Purchase orders

An example of the standard Intercompany functionality is association between purchase order in one company and sales order in another company.

Having a purchase order, you can get an intercompany sales order and having a sales order, you can get an intercompany purchase order.

Below are custom examples of receiving sales and purchase orders.

Picture11
Working with Intercompany functionality

Here is an example of standard code in MarkupCopy class that gets intercompany sales order..

Working with Intercompany functionality
Published On: / Categories: Tech article, CRM, ERP /

Upgrade your business strength with Dynamics 365

OntargIT is an official Microsoft partner for the implementation of Dynamics 365 technologies. With our experience in various industries, we will provide an individualized approach and effective solutions that will perfectly meet the needs of your company. Leave a request now, and our team of experts will help you take advantage of all the benefits of Dynamics 365.

Upgrade your business strength with Dynamics 365

OntargIT is an official Microsoft partner for the implementation of Dynamics 365 technologies. With our experience in various industries, we will provide an individualized approach and effective solutions that will perfectly meet the needs of your company. Leave a request now, and our team of experts will help you take advantage of all the benefits of Dynamics 365.