AX7/D365/Operations: Create Details Master pattern form

Posted on

Purpose:

The purpose of this document is to demonstrate how we can develop a Details Master form in Dynamics 365 for Operations. While doing so, it also shows how to apply the new form patterns and subpatterns.

Please note that the new Details Master pattern (Dynamics 365 for Operations) obsoletes the older ListPage pattern (AX 2012).

Prerequisites:

  • Access to Dynamics 365 for Operations instance via remote desktop.
  • To be provisioned as an administrator for the instance.
  • Visual Studio project, model, package have been created.
  • Custom table MAKInventRawMaterial has been created in the project.

Business requirement:

Ability to maintain records in a grid and detail view within the same form.

Development:

1. Click Ctrl+Shift+A to add new item to the project.
2. Navigate to User Interface > Form. Give a suitable name, MAKInventRawMaterial.

Form1

3. Drag and drop MAKInventRawMaterial table from the project to the Data Sources node.

Form2

4. Right-click Design node. Click Apply pattern > Details Master.

Form3

5. Once the pattern gets applied, open the Pattern pane to see the missing controls which need to be added to comply with the pattern.

Form4

6. Add the identified missing controls to the Design node in the same order as shown in the pattern tab.

Form5

7. As you can see after adding the required controls the violations have been but still there are some warnings.
8. Navigate to FormGroupControlNavigationList to view its Pattern tab. We still have missing controls for our Navigation List control.

Form6

9. Adding the identified missing controls resolves the pattern issues.

Form7

10. Repeat steps 6 – 9 till all the pattern and subpattern issues have been resolved by adding the missing controls. At the end of the process, you will have a completed form ready to add data source fields to.
11. Add the following field groups to the Details panel from data source table.

Form8DetailsTab

12. Add the AutoReport field group to the Grid control of the Grid panel.

Form9GridTab

13. Navigate to FormCommandButtonControl and set Command property to DetailsView.

Form10CommandButtonDetailsView

14. Navigate to FormGridControl and set Default Action property to the FormCommandButtonControl.

Form11GridDefaultAction

15. Right-click Project > Forms > MAKInventRawMaterial. Click Set as Startup Object.

StartupObject

16. Select project in your Solution Explorer and click Start in Visual Studio.
17. You should be able to see your form in action in the browser.
18. Grid view.

Form12GridView

19. Details view.

Form13DetailsView

AX7/D365/Operations: Create custom data entity

Posted on Updated on

Purpose:

The purpose of this document is to demonstrate how we can develop a custom data entity for a custom table in Dynamics 365 for Operations.

Prerequisites:

  • Access to Dynamics 365 for Operations instance via remote desktop.
  • To be provisioned as an administrator for the instance.
  • Visual Studio project, model, package have been created.
  • Custom table has been created in the project.

Business requirement:

Ability to perform data operations on custom table.

Development:

We’ll be developing a data entity for a custom table, MAKInventRawMaterial for this scenario.

1. Click Ctrl+Shift+A to add new item to the project.
2. Select Data Model > Data Entity, giving name MAKInventRawMaterialEntity. Click Add.

DataEntity1

3. Specify data entity properties as shown below and select MAKInventRawMaterial table as the Primary datasource. Click Next.

DataEntity2

4. On the next screen of the wizard, review the data entity fields. You may choose to Convert labels to field names. Click Finish.

DataEntity3

5. The following highlighted development artifacts must be created.

DataEntity5

6. Open project properties and set Synchronize Database on Build to True to synchronize the newly created table and data entity with database.

DataEntity4

7. You have now successfully created a custom data entity!

To see the custom data entity in action, please see the following post.

https://dynamicsaxinsight.wordpress.com/2017/06/13/ax7-d365-operations-data-import-using-data-entities/

 

AX7/D365/Operations: Data import using data entities

Posted on Updated on

Purpose:

The purpose of this document is to demonstrate how we can import data using data entities in Dynamics 365 for Operations.

Prerequisites:

  • Access to Dynamics 365 for Operations instance via remote desktop.
  • To be provisioned as an administrator for the instance.

Business requirement:

Ability to import/migrate legacy business data to Dynamics 365 for Operations.

Process:

1. Navigate to Workspaces > Data management > Import.
2. Enter job details as shown below. We have selected a custom data entity Raw material in this scenario. You can safely use any standard data entity instead.

DataEntity6

3. Click Upload to select and upload the source data file.
4. Click View map to generate field mappings.
5. On Map source to staging screen, click Mapping visualization.
6. Define the mapping. Click Save.

DataEntity7

7. Now go back to the job screen and click Import.
8. At the end of the execution, you should see the Execution summary.

DataEntity8

9. You can verify the data loaded by navigating to the relevant form. In this case Raw Materials details master form.

DataEntity9

AX7/D365/Operations: Create custom module

Posted on

Purpose:

The purpose of this document is to demonstrate how we can create custom module in the main menu for Dynamics 365 for Operations.

Prerequisites:

  • Access to Dynamics 365 for Operations instance via remote desktop.
  • To be provisioned as an administrator for the instance.
  • Visual Studio project, model, package have been created.

Business requirement:

Ability to navigate to custom module.

Development:

1. Click Ctrl+Shift+A to add new item to the project.
2. Add new Menu, MAKDevelopmentBasics, click Add.

Menu1

3. Open the newly added menu in the designer.
4. Right click it to add a new Submenu, Common.

Menu2

5. Drag and drop a display menu item to the submenu.

Menu3

6. In the Application Explorer, navigate to MainMenu and create an extension.

Menu4

7. Give a suitable name to the extension, MainMenu.MAKDevelopmentBasics.

Menu5

8. Open the newly created extension in the designer.
9. Drag and drop the MAKDevelopmentBasics menu to the extension of MainMenu.

Menu6

10. You should be able to see the custom module added to the Modules of the Dynamics 365 for Operations application.

MenuResult

AX7/D365/Operations: Data export using data entities

Posted on Updated on

DataManagement


Purpose:

The purpose of this document is to demonstrate how we can export data using out-of-band (OOB) data entities from Dynamics 365 for Operations.

Prerequisites:

  • Access to Dynamics 365 for Operations instance via remote desktop.
  • To be provisioned as an administrator or at least data management officer for the instance.

Business requirement:

Ability to export customer master for USMF legal entity.

Process:

1. Navigate to Workspaces > Data management.
2. Click Export tile.
3. Enter JOB DETAILS as follows. We have selected Customers data entity for this scenario.

Step1

4. Click Add entity button. You should see Customers data entity added to the right pane.
5. Click Export button.
5. After the job ends, you can see the count of records exported on the Execution summary screen.

Step3

6. Click the ellipsis button to download the file.

Step4

7. You should be able to see the exported records in the Excel file.

Result

AX7/D365/Operations: Data entities export data error

Posted on Updated on

Error1


 Exception:

While exporting data from local VM of Dynamics 365 for Operations, you might get an error if the Azure storage emulator is not running.

Microsoft.WindowsAzure.Storage.StorageException: Unable to connect to the remote server —> System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.

Resolution:

You can start the Azure storage emulator by following the steps below:

  1. On OneBox VM, run command prompt as administrator.
  2. Navigate to “C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\”
  3. Run “AzureStorageEmulator.exe start”

This should resolve the issue reported above which surfaces while exporting data through data entities in Dynamics 365 for Operations.

Emulator

AX 2012: Create SSRS Line Chart Report

Posted on Updated on

MakItemSalesHistory

 

Purpose:

The purpose of this document is to demonstrate how we can leverage the power of business intelligence through a simple SSRS line chart report.

Prerequisites:

  1. Visual Studio 2013
  2. Visual Studio 2013 tools.
  3. Reporting extension.
  4. Report Builder.
  5. Should be well-versed in Report Programming Model.

Business requirement:

Leverage business intelligence by analyzing sales trends for top item groups over the period of time.

Project overview:

MakItemSalesHistoryProject

Development:

We will be following the Report Programming Model to develop a precision design report.

1. Create an InMemory table, MakItemSalesHistoryTmp. This table will be used as a data set for the report in Visual Studio.

MakItemSalesHistory

2. Create an AOT query, MakItemSalesHistory. This query will be used in the Data Provider class to fetch records for the report.

MakItemSalesHistory

3. Create a data provider class, MakItemSalesHistoryDP. Bind the AOT query with it.

[
    SRSReportQueryAttribute(queryStr(MakItemSalesHistory))
]
class MakItemSalesHistoryDP extends SRSReportDataProviderBase
{
    MakItemSalesHistoryTmp  makItemSalesHistoryTmp;
}
[
    SRSReportDataSetAttribute(tableStr(MakItemSalesHistoryTmp))
]
public MakItemSalesHistoryTmp getItemSalesHistoryTmp()
{
    select makItemSalesHistoryTmp;
    return makItemSalesHistoryTmp;
}
private void insertTmpTable(SalesLine _salesLine)
{
    Qty                 qty;
    Date                shipDate;
    InventItemGroupItem groupItem;

    qty = _salesLine.QtyOrdered;
    shipDate = _salesLine.ShippingDateConfirmed;
    groupItem = InventItemGroupItem::findByItemIdLegalEntity(
        _salesLine.ItemId,
        _salesLine.DataAreaId);

    ttsBegin;
    makItemSalesHistoryTmp.clear();
    makItemSalesHistoryTmp.ItemId = _salesLine.ItemId;
    makItemSalesHistoryTmp.ItemGroupId = groupItem.ItemGroupId;
    makItemSalesHistoryTmp.Price = _salesLine.salesPrice;
    makItemSalesHistoryTmp.Amount = _salesLine.SalesPrice * Qty;
    makItemSalesHistoryTmp.Qty = qty;
    makItemSalesHistoryTmp.Year = year(shipDate);
    makItemSalesHistoryTmp.MonthOfYearId = mthOfYr(shipDate);
    makItemSalesHistoryTmp.Days = dayOfMth(shipDate);
    makItemSalesHistoryTmp.insert();
    ttsCommit;
}
[SysEntryPointAttribute(false)]
public void processReport()
{
    Query                   query;
    QueryRun                queryRun;
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbr;
    SalesLine               salesLine;
    InventItemGroup         ItemitemGroup;

    query = this.parmQuery();
    qbds = query.dataSourceTable(tableNum(InventItemGroupItem));
    qbds.name("InventItemGroupItem");

    qbr = qbds.addRange(fieldNum(InventItemGroupItem, ItemGroupId));
    qbr.value(strFmt('((%1.%2 == "Speakers") || (%1.%2 == "Television"))',
        qbds.name(),
        fieldStr(InventItemGroupItem, ItemGroupId)));

    queryRun = new queryRun(query);

    while (queryRun.next())
    {
        salesLine = queryRun.get(tableNum(salesLine));
        this.insertTmpTable(salesLine);
    }
}

4. Create a controller class, MakItemSalesHistoryController. You can observe, how the report dialog has been suppressed in the controller.

class MakItemSalesHistoryController extends SrsReportRunController
{
}
static void main(Args _args)
{
    MakItemSalesHistoryController controller;

    controller = new MakItemSalesHistoryController();
    controller.parmReportName(ssrsReportStr(MakItemSalesHistory, LineChart));
    controller.parmArgs(_args);
    controller.parmShowDialog(false);
    controller.startOperation();
}

5. In Visual Studio 2013

  • Create a new Project
  • Add new Report to the solution.
  • Add new Dataset, MakItemSalesHistoryTmp, of type Report Data Provider.
  • Choose MakItemSalesHistoryDP class in the Query.
  • Add new precision design, LineChart, to the report Designs node.

MakItemSalesHistory

6. Edit LineChart using Designer.
7. Insert a new Chart report item from the Toolbox.

MakItemSalesHistory

8. Double click on the chart area to open the field editor, add the following fields as specified.

Field Drop area
Year, MonthOfYearId Category
ItemGroupId Series
Qty Data

9. Next, you can improve the aesthetics of the chart, as it pleases, by updating different chart properties available out of the box in Visual Studio.
10. Save, build and deploy the report.
11. Create an output menu item and bind it with the SSRS report.

MakItemSalesHistory

12. Add menu item to Sales and marketing > Reports > Sales orders > Item sales history.
13. You should be able to see the report in the Report viewer.

MakItemSalesHistory