5 Ağustos 2014 Salı

AX 2012 - Add defaultdimension control to form

You can look for LedgerJournalTable form for how to do.
Add a relation with DimensionAttributeValueSet table's RecId  field for which field added from DimensionDefault EDT.

Add a tab page named tabFinancialDimensions and change properties like below:

AutoDeclaration = true
caption = @SYS101181
HideIfEmpty = No
NeedPermission = Manual

Add this line to forms classDeclaration method:

DimensionDefaultingController       dimensionDefaultingController;

Add this code part to forms init method:

public void init()
{

   boolean allowEdit = true;
    super();
    dimensionDefaultingController = DimensionDefaultingController::constructInTabWithValues(false, true, allowEdit, 0, this, tabFinancialDimensions, "@SYS101181");
    dimensionDefaultingController.parmAttributeValueSetDataSource(MyTable_ds, fieldStr(MyTable, DefaultDimension));
    dimensionDefaultingController.parmValidateBlockedForManualEntry(true);
}


Add this method to tab page:

public void pageActivated()
{
    dimensionDefaultingController.pageActivated();
    super();
}


Update table data source methods like below:

public void delete()
{
    super();
    DimensionDefaultingController.deleted();
}

public void write()
{
    ttsBegin;
    DimensionDefaultingController.writing();
    super();
    ttsCommit;
}

public int active()
{
    int ret;

    ret = super();
    DimensionDefaultingController.activated();
    return ret;
}


Hiç yorum yok:

Yorum Gönder