Posts

Showing posts from 2014

Refesh Parent form form child form / class

Hi, Below code is used to refresh the parent form from child form / class. write this method in parent form //TO refersh the current form (from child form) and point the cursor for the selected record. public void refreshForm() {     <DataSourceName>_ds.reread();     <DataSourceName>_ds.refresh();     <DataSourceName>_ds.rereadReferenceDataSources(); } write this method in Child form / Class I wrote the method in close method of the child form to refresh the parent form public void close() {      super ();    if (element.args().caller() && element.args().caller().name() == formStr (Alle_SubcontractorPayRegister))    {       element.args().caller().refreshForm();    } } I wrote the method in main method of the child class to refresh the parent form static void main(Args args) {     SCWPSCreation wpsCreation;     ;       wpsCreation = Alle_DLIIntegration_SCWPSCreation::construct();     wpsCreati

Create Default dimension - Ax 2012

Hi, The below code is used to create the default dimension in ax 2012. static void CreateDefaultDimension(Args _args) {     DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();     DimensionDefault result;     DimensionAttribute dimensionAttribute;     DimensionAttributeValue dimensionAttributeValue;      int i;     // Note that "Item" is not one of the default dimension,     // but DimensionAttributeValueSetStorage will handle it gracefully     container conAttr = [ "Department" , "ExpensePurpose" , "Item" ];     container conValue = [ "00000028" , "Training" , "1000" ];     str dimValue;     for (i = 1 ; i <= conLen (conAttr); i++)     {          dimensionAttribute = dimensionAttribute::findByName( conPeek (conAttr,i));         if (di

Create and Post GL journal - with Settlement marking

Hi, The below code is used to create and post the GL journal and also do the marking for the settlement. static void CreateGLJournalPost_withSettlement(Args _args) { AxLedgerJournalTable journalTable; // class AxLedgerJournalTrans journalTrans; // class container acctPattern; container offSetAcctPattern; LedgerJournalTable ledgerJournalTable; // table ledgerJournalCheckPost ledgerJournalCheckPost; // table void markSettlement(ledgerJournalTrans _ledgerJournalTrans,                     RefRecId _vendInvoiceJourRecId) //settlement voucher's recId { CustVendOpenTransManager manager; VendTransOpen vendTransOpen; ExchangeRateHelper exchangeRateHelper; AmountCur totalSettleAmount; RefRecId vendTransRecid; ; vendTransRecid = vendInvoiceJour::findRecId(_vendInvoiceJourRecId).vendTrans().RecId;  vendTransO

How to Extract Default dimension in Ax 2012

Hi, The below code is used to extract the default dimension in ax 2012. (Pass the default dimension rec id in the job and get the result of filled fin.dimensoin attribute name and values) http://yasirnedian.blogspot.ae/2014/04/get-default-financial-dimension-values.html or use the below job static void DefaultDimensions_Extract(Args _args) { VendTable vendTable; DimensionAttributeValueSet dimAttrValueSet; DimensionAttributeValueSetItem dimAttrValueSetItem; DimensionAttributeValue dimAttrValue; DimensionAttribute dimAttr; Common dimensionValueEntity; ;   // Find our supplier //vendTable = VendTable::find('3008'); // Find the dimension value set that the vendor points to (for specifying the // 'default' dimensions). This table is used as a sort of 'header' that the // value set items (Dimension

Create and Post GL Journal - mulit line voucher

Hi, The below job is used to create General journal (multiline voucher -> debit and credit in different line) and post it.   static void CreateGLJournalPost_multiLine(Args _args) {   AxLedgerJournalTable journalTable; // class AxLedgerJournalTrans journalTrans; // class container acctPattern; container offSetAcctPattern; LedgerJournalTable ledgerJournalTable; // table ledgerJournalCheckPost ledgerJournalCheckPost; // table     ;   journalTable = new AxLedgerJournalTable(); journalTrans = new AxLedgerJournalTrans(); //Journal Name journalTable.parmJournalName( "GenJrn" );   journalTable.save();   //Debit line     journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);   journalTrans.parmTransDate( systemDateGet ()); journalTrans.parmCurrencyCode( "AED" ); journalTrans.parmAmountCurDebit( 1200 );     journalTrans.

Create and post GL journal - single line voucher

Hi, The below job is used to create General journal (single line voucher -> both debit and credit in the same line) and post it.   static void CreateGLJournalPost(Args _args) { AxLedgerJournalTable journalTable; // class AxLedgerJournalTrans journalTrans; // class container acctPattern; container offSetAcctPattern; LedgerJournalTable ledgerJournalTable; // table ledgerJournalCheckPost ledgerJournalCheckPost; // table ; journalTable = new AxLedgerJournalTable(); journalTrans = new AxLedgerJournalTrans(); //Journal Name journalTable.parmJournalName( "GenJrn" ); journalTable.save(); journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate( systemDateGet ()); journalTrans.parmCurrencyCode( "AED" ); journalTrans.parmAmountCurDebit( 1200 ); journalTrans.parmAccountType(LedgerJournalACType::Ledger);

Delete All transaction in Ax company and keep Master data in it

Image
Hi, Sometimes, you may have a requirement to delete all the transactions in a company while keeping the Master data as it is. In order to achieve this you can duplicate the company and run SysDatabaseTransDelete class, which will delete all the transactions in the related company while keep the master data intact. 1. Press Ctrl + D. 2. Open Class node in AOT. 3. Find SysDatabaseTransDelete class, right click open, it will show the related company from which you want to delete the transactions. Note : Before performing the above steps on production please do it in test so you can come to know what exactly you achieve.

To access other Database tables from AX 2012 (using ADO.net)

Hi, The below code is used to connect the external DB to access tables from ax. (In this approach we eliminated the standard ODBC DSN configuration. which is time consuming process. because we have to setup the ODBC DSN in all client machine) static void GetCustomerInfoFromExternalDB(Args _args) {     System.Data.SqlClient.SqlConnectionStringBuilder     CSB;     System.Data.SqlClient.SqlConnection                  con;     System.Data.SqlClient.SqlCommand                     cmd;     System.Data.SqlClient.SqlParameterCollection         parmColl;     System.Data.SqlClient.SqlDataReader                  dataReader;     str                                                  sql,                                                         serverName,                                                         DatabaseName,                                                         conString;     System.Exception                                     InteropExcep