Friday, June 30, 2017

X++ code to Set Default dimension based on Dimension attribute and finanacial dimension Display Value in AX 2012


X++ code to Set Default dimension based on Dimension attribute and finanacial dimension Display Value in AX 2012 
Note:

1)Here DimensionDefault is financial dimension combination( i.e recid),
2)Name is Like Dimension attribute name(ex Department).
3)_dimvalue is Displayvalue


public static DimensionDefault setDefaultDimension(DimensionDefault defaultDimension, Name _dimensionAttributeName, str  _dimValue)

{

    DimensionAttributeValue             dimAttrValue;

    DimensionAttribute                  dimAttr;

    DimensionAttributeValueSetStorage   dimAttrValueSetStorage;



    dimAttrValueSetStorage = DimensionAttributeValueSetStorage::find(defaultDimension);



    dimAttr         = DimensionAttribute::findByName(_dimensionAttributeName);

    dimAttrValue    = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, _dimValue, false, true);

    if(dimAttrValue)

    {

        dimAttrValueSetStorage.addItem(dimAttrValue);

        return dimAttrValueSetStorage.save();

    }

    return defaultDimension;

}


Keep Daxing :)

x++ code to find Financial dimension Display value for based on default dimension with respective Dimension attribute in ax 2012


Hi Reader's,

lets learn small tip to show up display value based on default dimension with respective Dimension attribute in ax 2012

Note:

1)Here DimensionDefault is financial dimension combination( i.e recid),
2)Name is Like Dimension attribute name(ex Department).


public static DimensionValue getDimensionValue(DimensionDefault _dimensionDefault, Name _dimensionAttributeName)
{
    DimensionAttribute                 attribute;
    DimensionAttributeValueSetItemView valueSetItemView;

    attribute   = DimensionAttribute::findByName(_dimensionAttributeName);

    select DisplayValue from valueSetItemView
        where valueSetItemView.DimensionAttributeValueSet == _dimensionDefault
        && valueSetItemView.DimensionAttribute == attribute.RecId;

    return valueSetItemView.DisplayValue;
}

Keep Daxing !!!

Friday, June 23, 2017

Tables hit while creating Service orders up to invoice posting  in ax 2012


Tables hit while creating Service orders up to invoice posting  in ax 2012
The flow data will be as follows.
SMAServiceOrderTable >> SMAServiceOrderLine>> InventJournalTrans>> ProjItemTrans>> ProjProposalItem>> ProjInvoiceItem>> ProjProposalItemDetail>> ProjItemTransSale

SMAServiceOrderTable: The SMAServiceOrderTable table contains service orders. The service orders can be linked to agreements or be stand-alone orders that are linked to projects.

SMAServiceOrderLine: The SMAServiceOrderLine table contains service order lines that specify the detailed work, items, fees, and expenses of an individual service order.

InventJournalTrans : The InventJournalTrans table contains information about items and represents a line in an inventory journal. Each record has information related to a specific item and is related to a record in the InventJournalTable table, which is the journal header.

ProjItemTrans: The ProjItemTrans table is used to store posted item transactions of projects.  Posting an item journal will create records on this table.(i.e Posted service orders).



ProjProposalItem :The ProjProposalItem table stores project invoice proposal lines of the item transaction type.  The ProjProposalItem records are the item transactions that will be billed to the customer when the invoice proposal is posted.

ProjInvoiceItem :The ProjInvoiceItem table stores posted project invoice lines of the item transaction type.  Posting an invoice proposal with item transactions will create records in the ProjInvoiceItem table.

ProjProposalItemDetail :The ProjProposalItemDetail table stores the project invoice proposal lines of item transactions. These records are the item transactions that will be billed to the customer when the invoice proposal is posted.

ProjItemTransSale:The ProjItemTransSale table contains project item sale transactions.

Keep Daxing !!!

Thursday, June 22, 2017

X++ code for Look up to filter only Global Addresses with respect to Purpose :: Like Delivery Addresses.

Hi Folk's

Recently,I was gone through with an weird requirement to filter the Global Addresses with respect to Purpose :: Like Delivery Addresses.

Note : Here the form control is Reference group.

public Common lookupReference(FormReferenceControl _formReferenceControl)

{

    Query                       query;

    QueryBuildDataSource        qbds,qbds1,qbds2,qbds3;

    QueryBuildRange             qbr;

    SysReferenceTableLookup     sysRefTableLookup;

    LogisticsPostalAddress      logisticsPostalAddress;



    sysRefTableLookup = SysReferenceTableLookup::newParameters(tableNum(LogisticsPostalAddress),_formReferenceControl,true);

    sysRefTableLookup.addLookupfield(fieldNum(logisticsPostalAddress,Address));

    sysRefTableLookup.addLookupMethod(tableMethodStr(logisticsPostalAddress,displayLocationDescription));



    query = new Query();

    qbds  = query.addDataSource(tableNum(LogisticsPostalAddress));

    qbds1 = qbds.addDataSource(tableNum(DirPartyLocation));

    qbds1.joinMode(JoinMode::ExistsJoin);

    qbds1.relations(true);

    qbds1.addLink(fieldnum(DirPartyLocation,location),fieldNum(LogisticsPostalAddress,location));


    qbds2 = qbds1.addDataSource(tableNum(DirPartyLocationRole));

    qbds2.joinMode(JoinMode::ExistsJoin);

    qbds2.relations(true);



    qbds3 = qbds2.addDataSource(tableNum(LogisticsLocationRole)); 

    qbds3.joinMode(JoinMode::ExistsJoin);

    qbds3.relations(true);

    qbr = qbds3.addRange(fieldNum(LogisticsLocationRole,Type));

    qbr.value(enum2str(LogisticsLocationRoleType::Delivery));



    sysRefTableLookup.parmQuery(query);

    logisticsPostalAddress = sysRefTableLookup.performFormLookup();





    return logisticsPostalAddress;

} 

Keep Daxing !!!

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...