create a product using service

private void createProduct(itemId _itemId, DataAreaId _dataAreaId = curext() ) { EcoResProductService ecoResProdService; EcoResEcoResProduct ecoResProduct; EcoResEcoResProduct_Product_Distinct product; EcoResEcoResProduct_Translation translation; EcoResEcoResProduct_Identifier identifier; EcoResEcoResProduct_StorageDimGroup storageDimGroup; EcoResEcoResProduct_TrackingDimGroup trackingDimensionGroup; ; ecoResProdService = EcoResProductService::construct(); ecoResProduct = new EcoResEcoResProduct(); product = new EcoResEcoResProduct_Product_Distinct(); //Newly created and initialize product product.parmDisplayProductNumber(“demo5”); product.parmProductType(EcoResProductType::Item); product.parmSearchName(“demo5”); //Create a new translation object: Translation = product.createTranslation().addNew(); Translation.parmDescription(“demo5”); Translation.parmLanguageId(CompanyInfo::languageId()); Translation.parmName(“demo5”);…

Create a Product master through service

static void CreateEcoResProduct(Args _args) { EcoResEcoResProduct_TrackingDimGroup tracDimGroup; EcoResEcoResProduct_Product_Master productMaster; EcoResEcoResProduct_Product_Distinct distMaster; EcoResEcoResProduct_ProductDimGroup prodDimGroup; EcoResEcoResProduct_StorageDimGroup storDimGroup; EcoResEcoResProduct_translation translation; EcoResEcoResProduct_Identifier identifier; EcoResProductService ecoProdSvc; EcoResProductNumber lEcoResProductNumber; NumberSequenceTable numberSequenceTable; EcoResEcoResProduct ecoResProd; EcoResProductType ecoResProductType; boolean isMaster = false; EcoResProductSearchName _ecmProductName; EcoResProductSubtype prodSubType; ; prodSubType = EcoResProductSubtype::ProductMaster; _ecmProductName = “Demo2”; lEcoResProductNumber = “Demo2”; try { // create product by initializing the…

Using complex query ranges

public void lookup(FormControl _formControl, str _filterStr) { Query query = new Query(); QueryBuildDataSource queryDataSourceCode; QueryBuildRange queryBuildRange; SysTableLookup sysTableLookup; str st; ; sysTableLookup=SysTableLookup::newParameters(tableNum(InventTable), _formControl); sysTableLookup.addLookupField(fieldNum(InventTable, ItemId)); sysTableLookup.addLookupField(fieldNum(InventTable, NameAlias)); queryDataSourceCode = query.addDataSource(tableNum(InventTable)); queryDataSourceCode.addRange(fieldNum(InventTable, ItemId)).value( strFmt(‘(((%1.%2 >= 40) && (%1.%2 <= 60)) || ((%1.%3 >= 20) && (%1.%3 <= 30)))’, queryDataSourceCode.name(), fieldStr(InventTable, NetWeight), fieldStr(InventTable, TaraWeight))); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); }

Create and post movement journal in AX 2012

static void createMovementJournalAx(Args _args) { AxInventJournalTable AxinventJournalTable = new AxinventJournalTable(); AxInventJournalTrans AxinventJournalTrans = new AxinventJournalTrans(); InventJournalNameId inventJournalName; AxInventDim axinventDim = new axinventDim(); JournalCheckPost journalCheckPost; //Below code creates journal header //inventJournalTable.clear(); inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement); AxinventJournalTable.parmJournalNameId(inventJournalName); AxinventJournalTable.parmLedgerDimension(InventJournalName::find(inventJournalName).LedgerDimension); AxinventJournalTable.save(); //Below code creates journal lines //inventJournalTrans.clear(); // AXinventJournalTrans.inventJournalTableRecord(AxinventJournalTable.inventJournalTable()); AXinventJournalTrans.parmJournalId(AXinventJournalTable.parmJournalId()); AXinventJournalTrans.parmTransDate(systemDateGet()); AXinventJournalTrans.parmLedgerDimension(AxinventJournalTable.parmLedgerDimension()); //inventJournalTrans.ItemId = “S0010″; // AXinventJournalTrans.inventTableRecord(InventTable::find(“S0010″)); AXinventJournalTrans.parmItemId(‘8.1134.434/14’); AxinventJournalTrans.parmQty(10); //AxinventJournalTrans.parmCostPrice(10);…

Edit method and number seq code

public void initValue() { NumberSeq NumSeq; ; super(); NumSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesQuoteId(), true); SalesQuoteTable.QuoteId = NumSeq.num(); }   edit NoYes markSalesLine(boolean _set, salesquoteLine _salesquoteLine, NoYes _value) { NoYes ret; ; if (_salesquoteLine) { if (_set) { if (_value == NoYes::Yes) { S.add(_salesquoteLine.RecId); } else { s.remove(_salesquoteLine.RecId); } } else { ret = s.in(_salesquoteLine.RecId); } } return…