Microsoft Dynamics AX development

Archive for January, 2016

Add a new datasource to InventOnHandItem form

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

Advertisements

Post Product receipt from code X++

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();

Confirm Purchase Order from code X++

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

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

Keep table group on one page

To keep table groups on the same page, the table group should look like this:

Aufnahme1

Then, select the group row and set the properties “KeepTogheter” to True.

Aufnahme2

Deploy the report.

 

Tag Cloud