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

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...