Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Monday, August 5, 2013

Find methods() / inserting the values from one form where action is taking place is to be reflect in another form in Dynamic AX

Hi,

public void modified()
{
        SMAServiceObjectTable   smaServiceObjectTable;
    SMAServiceOrderTable    smaServiceOrderTable, smaServiceOrderTable1;
    //Tables I used here and smaServiceOrderTable1 will act as datasource that I added
    TableId                 loctableid;
    super();
    loctableid = element.args().record().TableId;
    if (loctableid == tableNum(smaServiceOrderTable))
        smaServiceOrderTable = element.args().record();
    ttsBegin;
    //Updated by Alfasith- This to display in OrderFormTable
    select forUpdate smaServiceOrderTable1 where smaServiceOrderTable1.RecId == smaServiceOrderTable.RecId;
    smaServiceOrderTable1.AssetId = smaServiceObjectTable::find(SMAServiceObjectRelation.ServiceObjectId).AssetId;
    smaServiceOrderTable1.VehicleRegistrationNo  =  AssetTable::find(smaServiceObjectTable::find(SMAServiceObjectRelation.ServiceObjectId).AssetId).SerialNum;//SMAServiceObjectTable::find(SMAServiceObjectRelation.ServiceObjectId).vehicleRegistrationNo();
    smaServiceOrderTable1.VehicleType  = SMAServiceObjectTable::find(SMAServiceObjectRelation.ServiceObjectId).vehicleType();
    smaServiceOrderTable1.Make  = AssetTable::findByServiceObjectId(SMAServiceObjectRelation.ServiceObjectId).Make;
    smaServiceOrderTable1.NQ_ServiceCentreCode  = smaServiceObjectTable::find(SMAServiceObjectRelation.ServiceObjectId).serviceCentre();
    smaServiceOrderTable1.update();
    ttsCommit;
}

This above sample makes the sense of adding new fields in the form where two forms are involved and results should reflect in another form

No comments:

Post a Comment

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...