Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Modifiedfield method in Table Extension

$
0
0

Hi All,

I want to when inputting ItemId, some fields will be filled automatically. But I don't know the problem with my coding so it can't input automatically. I have debugged and the field is filled. However, when the field is executed it is not filled. Does anyone know what's the problem?

[Extensionof(tableStr(SalesQuotationLine))]
final class SalesQuotationTable_SalesPrice_Extension
{
    [DataEventHandler(tableStr(SalesQuotationLine), DataEventType::ModifiedField)]
    public static void SalesQuotationLine_onModifiedField(Common sender, DataEventArgs e)
    {
        ModifyFieldEventArgs    event           = e as ModifyFieldEventArgs;
        SalesQuotationLine      salesQuotLine   = sender as SalesQuotationLine;
        FieldId                 fieldId         = event.parmFieldId();
        PriceDiscTable          priceDiscTable;
        switch(fieldId)
        {
            case fieldNum(SalesQuotationLine,ItemId):
                select priceDiscTable where priceDiscTable.ItemRelation == salesQuotLine.ItemId && priceDiscTable.ItemCode == PriceDiscProductCodeType::Table;
                if(priceDiscTable)
                {
                    salesQuotLine.ZIris         = priceDiscTable.ZIris;
                    salesQuotLine.ZUpFront      = priceDiscTable.ZUpFront;
                    salesQuotLine.ZOngkir       = priceDiscTable.ZOngkir;
                    salesQuotLine.ZIncentiveDealerSalesman  = priceDiscTable.ZIncentiveDealerSalesman;
                    salesQuotLine.ZIrisBruto    = priceDiscTable.ZIrisBruto;
                    salesQuotLine.ZRoomDealer   = priceDiscTable.ZRoomDealer;
                    salesQuotLine.ZOTR          = priceDiscTable.ZOTR;
                    salesQuotLine.ZNotice       = priceDiscTable.ZNotice;
                    salesQuotLine.ZUnNotice     = priceDiscTable.ZUnNotice;
                    salesQuotLine.ZCost         = priceDiscTable.ZCost;
                    salesQuotLine.ZRoomDiscount = priceDiscTable.ZRoomDiscount;
                    info(strFmt("priceDiscTable = %1", priceDiscTable.RecId));
                }
                break;
        }
    }

}


Thanks,


Viewing all articles
Browse latest Browse all 72043

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>