Posts

Showing posts from 2014

SalesTable2Line custom field update prompt on Sales order in AX 2012

Image
 Dynamics AX has standard functionality to show a prompt for any common fields on Sales Header & Lines are being updated on header. This prompt is based on the setup done on the AR Parameters form -> Updates -> Update order lines button If we want to have our custom field to behave in same manner, then we need to do following steps. 1. Create your new field on the SalesTable & SalesLine tables. Here for I am going to use field as "AS_TitleTransfer" 2. Add the  AS_TitleTransfer field to SalesTable field group HeaderToLineUpdate. 3. Add the new field on the Header & Lines section on SalesTable form like on General Tab. 4. In the AxSalesTable class add parm & set methods for new field. public <<your EDT>> parmAS_TitleTransfer( <<your EDT>>  _Id = '') {     if (!prmisDefault(_Id))     {         this.setField(fieldNum(SalesTable, AS_Ti...

Check if Invoice Date is in current Ledger Period using X++

public boolean AS_isInvoiceInCurrentLedgerPeriod(TransDate _transDate, TransDate _oldDate) {     FiscalCalendarPeriod         oldPeriod;     FiscalCalendarPeriod         newPeriod;     FiscalCalendarRecId          fiscalCalendarRecId = CompanyInfo::fiscalCalendarRecId();     LedgerFiscalCalendarPeriod   ledgerFiscalCalendarPeriod;     if (!FiscalCalendars::findYearEndClosingPeriodByDate(fiscalCalendarRecId, _transDate).RecId)     {         // The transaction date is not in a valid period.         return checkFailed("@GLS54501");     }     oldPeriod = FiscalCalendars::findPeriodByPeriodCodeDate(fiscalCalendarRecId, _oldDate);     newPeriod = FiscalCalendars::findPeriodByPeriodCodeDate(fiscalCalendarRecId, _transDate);     if (!newPeriod.RecId)...

Inventory period open checking using X++

public boolean isInventPeriodOpen(TransDate              testDate,                                  boolean                onDateOk = false,                                  InventTransCurrency_RU _inventTransCurrency = InventTransCurrency_RU::PrimaryCur) {     #ISOCountryRegionCodes     TransDate closingDate = InventClosing::closingDate(false, _inventTransCurrency);     if (!SysCountryRegionCode::isLegalEntityInCountryRegion([#isoRU]) || testDate)     {         if ((testDate <= closingDate && !onDateOk) ||             (testDate <  closingDate &&  onDateOk))         {  ...

Purchase Order Invoice posting with using X++ with custom VendInvoiceInfoLine fields

private boolean postPOInvoice(PurchTable purchTable) {     PurchFormLetter         letter      = purchFormLetter::construct(DocumentStatus::Invoice);     PurchParmUpdate         purchParmUpdate;     PurchLine               purchLineLocal;     VendInvoiceInfoTable    vendInvoiceInfoTable;     VendInvoiceInfoLine     vendInvoiceInfoLine, vendInvoiceInfoLineFrom;          boolean                 ret = true;                   letter.purchTable(purchTable);         letter.initParmDefault();         letter.transDate          (systemdateget());         letter.specQty            (PurchUp...

Sales order invoice posting using X++ with custom SalesParmLine fields

private boolean postSOInvoice(SalesTable salesTable) {     SalesFormLetter     letter      = SalesFormLetter::construct(DocumentStatus::Invoice);     CustInvoiceTrans    custInvoiceTransFrom;     SalesParmLine       salesParmLine;     SalesParmUpdate     salesParmUpdate;     SalesLine           salesLineLocal;          boolean             ret = true;         letter.salesTable(salesTable);         letter.initParmDefault();         letter.transDate          (systemDateGet());         letter.specQty            (SalesUpdate::All);         letter.proforma           (false);       ...