Microsoft Dynamics AX development

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

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

aufnahme1

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):

aufnahme6

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

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:

aufnahme4

In this way we haven’t anymore duplicates.

 

Scenario:
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)

Aufnahme2.png

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

Aufnahme3.png

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

Compile and refresh the mapping.

 

Scenario:
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).

untitled

Solution:
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.

Scenario:

    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.

To add a new datasource to the form InventOnHandItem, you have to follow these steps.

In my case I’ve added the (InventTable).GTIN to the form.

Add the table (in the example I’ve used the InventTable) to the form’s datasource

Aufnahme1

Modify the method modifyQuery in the class InventDimCtrl_Frm_OnHand:

  • add the new datasource to the method declaration and add a new variable for the new QueryBuildDataSource:

Aufnahme4

  • add the following code at the end of the method

 

Aufnahme2

  • it is important that the field you want to add to the InventOnHandItem is the “group by field”.

This is the result:

Aufnahme7

PurchFormLetter  purchFormLetter
ProductReceiptId productReceiptId;
PurchLine        purchLine;
PurchTable       purchTable = PurchTable::find('123456');
PurchQty         purchQty = 20;

while select purchLine
where purchLine.PurchId == purchTable.PurchId
&& purchLine.IsDeleted == NoYes::No
{
purchLine.PurchReceiveNow = purchQty;
purchLine.setInventReceiveNow();
purchLine.update();
}

purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip);
purchFormLetter.update(purchTable, productReceiptId, purchFormLetter.transDate(), PurchUpdate::ReceiveNow);
purchTable.reread();

PurchFormLetter purchFormLetter
PurchTable purchTable = PurchTable::find('123456');
PackingSlipId packingSlipId = 'PS_01';

purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
purchFormLetter.update(purchTable, packingSlipId);
purchTable.reread();

Tag Cloud