Microsoft Dynamics AX development

Scenario: I have two textbox on the same line. Textbox A and Textbox B. Both have an hidden expression in order to hide the textbox if empty.


If the Textbox A is empty, maintains the white space in the layout.


The solution is to insert the two textbox in a rectangle.


In this way, the space of the textbox A is removed.


The entity DMFPriceDiscAdmTransEntity requires the field JournalNum.
I want to generate automatically this number.

In the class DmfPriceDiscAdmTransEntityClass I’ve added a new method:


If I start another “Copy data to target”, I hava already the JournalNum (and an existing Price journal) and the target records will be updated (if the journal is not posted).

In the method generatePriceDiscTableLink I’ve called the new method:



I have to create a dialog with SrsReportDataContractUIBuilder with:

  • a flag “MyFlag”
  • a button “MyButton”

When the flag is active, I have to disable the button.
When the flag is not active, I have to enable the button.

Create the UIBuilder class:

class MyUIBuilderClass extends SrsReportDataContractUIBuilder
    MyClassNameContract       contract;
    FormBuildButtonControl    myButton;
    DialogField               myFlag;

In the postBuild method, initialize the dialog with the controls:

Dialog                  dialogLocal;
Form                    form;
DialogGroup             dialogGroup;
FormBuildGroupControl   groupBuildControl;

dialogLocal = this.dialog();
contract = this.dataContractObject() as MyClassNameContract;
form = this.dialog().form();

myFlag = this.addDialogField(methodStr(MyClassNameContract, parmMyFlag), 

dialogGroup = dialogLocal.addGroup('My group name');
groupBuildControl = dialogLocal.formBuildDesign().control(
buttonBuildControl = groupBuildControl.addControl(FormControlType::Button, 
                     'My button name');


myButton.text(literalStr("A text for my button"));

//if you want to add a method for the button
myButton.registerOverrideMethod(methodStr(FormButtonControl, clicked), 
         methodStr(MyUIBuilderClass, methodForTheButton), this);

myFlag = this.bindInfo().getDialogField(this.dataContractObject(), 
         methodStr(MyClassNameContract, parmMyFlag));
myFlag.registerOverrideMethod(methodStr(FormChecKBoxControl, modified), 
       methodStr(MyUIBuilderClass, enableDisableMyButton), this);



In the method enableDisableMyButton:

public boolean enableDisableMyButton(FormCheckBoxControl _checkBoxControl)
    int ctrlId          = dialog.formRun().controlId('My button name');
    FormControl control = dialog.formRun().control(ctrlId);


    return true;


Insert the logic to bind the UIBuilder to the contract class, in the attributes:


The “Generate mapping” regenerate the mapping from staging to target.

When we click on “Generate mapping” we have two possibility:


Generate the mapping from scratch
It means that AX deletes and recreate the mapping. With this options all the (possible) manual modifications are deleted.

Generate the mapping from modifications
It means that AX adds the modifications to the existing mapping and the (possible) manual modifications are preserved. But, with this option we have a problem, if we have overwritten the method “getMappings()”.
AX creates duplicate mappings for those specified in this method.
For example, entity DMFProductEntity.

Method “getMappings” of the class (take into consideration the field AllocateMarkup):


Here we have the mapping BEFORE the “Generate mapping from modifications”:

Here we have the mapping AFTER  the “Generate mapping from modifications”:
aufnahme3The problem is that AX does not control if a  mapping already exists for the entity.

The method that duplicates the mappings is on the table DMFTargetXMLToEntityMap.generateMapping(). I’ve found a solution and added the following modification in order to control if the mapping already exists:


In this way we haven’t anymore duplicates.


I want to mapping one field in the staging table with multiple fields on the target table.
In the image, the field EmploymentType is mapped with two fields on the target table.

(For the example I’ve used the Employee entity)


To do this, you have to add a mapping in the code. For example, view the class DMFEmployeeEntityClass, method getMapping:


In the example, the field DMFEmployeeTargetEntity.PersonnelNumer is mapped with the HcmWorker.PersonnelNumber and the RetailStaffTable.StaffId.

Compile and refresh the mapping.


I have a user that is associated to a custom role (TradeSalesClerk + other permissions/duties).

I’ve added the following permissions to the role:

  • SalesQuotationGenerate
  • SalesQuotationTableDetailsMaintain

but in the form of the customers (CustTableListPage + CustTable) the user does not see the button for the creation of a sales quotation (see picture below).


In the permission “SalesQuotationTableDetailsMaintain”, the entry point “SalesCreateQuotation” has AccessLevel = read.
I’ve changed the AccessLevel to “Create”, and it resolves the problem!

The problem was caused due to the fact that the menu item SalesCreateQuotation used in the CustTableListPage form was defined as entry point in privilege SalesQuotationTableDetailsMaintain with entry mode “Read”, but on the CustTableListPage form the button had the property “OpenMode” set to “New”.

In this case the security framework “hides” the button as the user has only defined the “View” permission although “Create” is required to invoke the Button.


When I start the invent recalculation (Inventory and warehouse management > Periodic > Closing and adjustment), I receive the following error:

You can’t have unallocated cost on a planning formula.


    1. Create a production order and started it
      In this moment the system creates the transaction on the production order header
      untitledand the corresponding records in the InventTransOriginAssemplyComponent table.
    2. Create the Picking List and the Route Card and posted them with positive quantity and the flag “End”, on the lines, set to true.
    3. Create the Report as Finished with quantity 0 and the flag “Report as finished” on the line set to true (set to true the field “Accepr error” on the journal header) and post the journal
      In this moment the system deletes the transaction on the production order header and the corresponding records in the InventTransOriginAssemplyComponent table.
    4. Recreate a new Report as Finished with positive quantity and the flag “Report as finished” on the line set to true – save the journal
      In this moment the system recreates the transaction on the production order header WITHOUT the corresponding records in the InventTransOriginAssemplyComponent table.

Solution: Resolved with hotfix KB 2935085.

Tag Cloud