Alfasith AX

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

Thursday, May 29, 2014

Get vendor information in Dynamic AX

Hi,

static void GetVendInfo_Alfasith(Args _args)
{
    VendTable       vendTable;
    ;
    vendTable =  VendTable::find("1101"); // select the vendor account here
    info(strFmt("Name: %1", vendTable.name()));
    info(strFmt("Telephone    : %1", vendTable.phone()));
    info(strFmt("email        : %1", vendTable.email()));
    info(strFmt("Website/ blog: %1", vendTable.url()));
    info(strFmt("Fax          : %1", vendTable.telefax()));
    info(strFmt("Address      : %1", vendTable.postalAddress().Address));
}



Regards,

Sunday, May 25, 2014

insert_recordset in dynamic AX - Insert all the records to duplicate table.

Hi,

Normally we used to insert the record like below to transfer the record from 1 table to another.

SourceTableName SourceTbl;
DestinationTableName DestinationTbl;
int records;
ttsBegin;
while select * from SourceTbl
    where SourceTbl.tabId > 0
{
    DestinationTbl.Field1        = SourceTbl.Field1;
    DestinationTbl.Field2       = SourceTbl.Field2;
    DestinationTbl.Field3        = SourceTbl.Field3;
    //So on fields... but it should n=match with datatype / EDT /Enum
    DestinationTbl.insert();
    records++;
}
ttsCommit;
info(records);
/********************************************/
but AX there is another feature to insert the bulk of record without transmission delay in reduced set of codes.

Same above code is reduced to.

insert_recordset DestinationTbl 
    select SourceTbl
         // where SourceTbl.Feild1 <= 100 
// If you have any condition to filter else al the record will be transfer
 /*****************************************************/
If you want to map the fields you need to.
insert_recordset DestinationTbl (Feild1, Feild2, Feild3...)
    select Feild1, Feild2, Feild3... 
        from SourceTbl
            where SourceTbl.Feild1 <= 100; //if condition 

Regards,




How to invoke and iterate List as Contract methods in AX 2012/ D365

Hi, Public void performContractIterate(ClassContainsListAsContract    _ListCarryClass) { List contractFieldList = new List(Types::Class); ...