Alfasith AX

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

Sunday, June 8, 2014

To duplicate a record in the same table in Dynamic AX

Hi,

static void ToDuplicate1RecordIntoSameTable(Args _args)
{
MyTable MyTable1;
MyTable MyTable2;
MyTable1 = myTable::find('0000526');
ttsBegin;
MyTable2.data(MyTable1);
MyTable2.HcmPersonnelNumberId = '000555'; // Index fileds needs to changed else it throws error
if (!MyTable2.validateWrite())
{
    throw Exception::Error;
}
MyTable2.insert();
ttsCommit;
    info("Duplicate record inserted");
}

Regards,

Customization or completed development of SalesInvoice report in Dynamic AX 2012

Hi,

DP - SalesInvoiceDP
Contract - SalesInvoiceContract
Conttroller - SalesInvoiceController
Temporary Header table - salesInvoiceHeaderFooterTmp
Temporary Header table - salesInvoiceLocalizationTmp
Temporary lines table - salesInvoiceTmp
(Its not tempDB but the records will be deleted once the transaction completes)

Details about DP and explaination of few method
(Not all the method I explaied only mandrantry method)
I added few fields in the lines table and inserted values.


Methods Description Country
generateInvoiceHeaderLocalizationData Populates a SalesInvoiceHeaderFooterTmp record for the Eastern Europe countries. EA
getDataFromContract Initializes data from the contract class. (Overrides the getDataFromContract Method.)  
getInvoiceCount_IN Calculates the invoice count. For line count  
insertCreditNoteSummaryLine_PL Insert the credit note summary line. (Overrides the insertCreditNoteSummaryLine_PL Method.)  
insertDataInSalesInvoiceTmp_IN Inserts data into SalesInvoiceTmp_IN table. Only for India
insertIntoSalesInvoiceHeaderFooterTmp Inserts the invoice header information.  
insertIntoSalesInvoiceLocalizationTmp Inserts the invoice detail information.  
insertIntoSalesInvoiceTmp Inserts the invoice detail information.  
processReport Processes the report business logic. (Overrides the processReport Method.)  
Regards,

Saturday, June 7, 2014

Customization or complete development of Purchase order report in Dynamic AX 2012

Hi,

DP - PurchPurchseOrderDP
Contract - PurchPurchaseOrderContract
Controller - PurchPurchaseOrderController.
Temporary Header table - PurchPurchaseOrderHeader
(Its not tempDB but the records will be deleted once the transaction completes)
Temporary lines table - PurchPurchaseOrderTmp

Details about DP and uses of main method
(Not all the method I explained only mandatory methods)

Method Description
setPurchPurchaseOrderDetails Inserts the record field data into the temporary table. (Here I added my customized line fields in to the table)
setPurchPurchaseOrderHeader Inserts common data into the template table buffer.
in lines table standard passes the values by 1 to 1 relation where as in header by insert_recordset technique fetching from PurchTable

Regards,

Thursday, June 5, 2014

Getting String value for the Amount in Dynamic AX

Hi,

// By fasith for getting the string value of amount
   SalesInvoiceTmp.StrTotAmount = numeralsToTxt_in(_custInvoiceJour.InvoiceAmount);

Regards,

Wednesday, June 4, 2014

Opening the table through x++ code - Dynamic AX

Hi,

static void OpenTableAlfasith(Args _args)
{
SysTableBrowser sysTableBrowser = new SysTableBrowser();
;

sysTableBrowser.run(tablenum(HCMWorker));// Table I selected is HCMWorker
}

Regards,

Tuesday, June 3, 2014

Code to get the customer city by customer ID in dynamic AX - Relation between CustTable, Dirparty table, logisticAddress table in dynamic AX

Hi,

static void GetCustCityAlfasith(Args _args)
{
    Custtable    Custtable;
    Str Description;
    Str    address;
    ;
    Custtable = Custtable::find("1101");
    info(strfmt("Location : %1",Dirparty::PrimarypostalAddress(Custtable.Party).displayLocationDescription()));
    info(strfmt("City     : %1",Dirparty::primaryPOstalAddress(Custtable.Party).City));
    info(strfmt("Country  : %1",Dirparty::primaryPOstalAddress(Custtable.Party).CountryRegionId));
}

Regards,

Get a table ID in SQL / table browser - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' <URL>/?cmp=<CompanyID>&mi=sysTableBrowser...