Blog

Name is Anant Dubey and the intent to create this blog is to discuss the problems and issues that developer face in the dynamics AX development and to share the new things that come up with the new version of AX.

Monday, March 24, 2025

configure Retail components on dev environment in D365FO

 


configure Retail components on dev environment


Configure retail re-targeting tool

k: deployable package/ select latest pkg/retail server/scripts/ 

open powershell with admin and run

retargetretailserver.ps1


Configure retail tenant update tool

k: deployable package/ select latest pkg/retail server/scripts/ 

open powershell with admin and run

RetailTenantUpdateTool.ps1


or

k:retailSDK/tools

run

Monday, January 13, 2025

Import Transfer Journal using CSV in AX 2012

Below is the CSV import format JournalID,itemId,FromSiteId,FromWarehouse,FromLocation,FromSize,FromColor,FromConfig,FromStyle,ToSiteId,ToWarehouse,ToLocation,ToSize,ToColor,ToConfig,ToStyle,Qty,CostPrice,CostAmount,dimcustomer, dimDepartment, dimEmployee, dimLocation, dimRetailStores, dimVendor INJ-019996,100185,2001,WH001,Stock,,White,A,KEN,2001,CW0001,Stock,,White,A,KEN,15,20,200,,,,2099-Whole,, ---------------------------------------------------------------------------------------------------------------- Below is the Dynamics AX Code static void ADImportTransferJournal(Args _args) { CommaTextIO csvFile; container readCon; Dialog dialog; DialogField dfFileName; FileName fileName; ItemId itemId; InventJournalTable inventJournalTable; InventJournalTrans inventJournalTrans; InventDim frominventDim, ToinventDim; JournalCheckPost inventJournalCheckPost; DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage(); DimensionDefault result; int i; DimensionAttribute dimensionAttribute; DimensionAttributeValue dimensionAttributeValue; container conAttr; container conValue, conLedgerDimension; str dimValue; DimensionDisplayValue dimcustomerFrom, dimDepartmentFrom, dimEmployeeFrom, dimLocationFrom, dimRetailStoresFrom, dimVendorFrom; DimensionDisplayValue dimcustomerTo, dimDepartmentTo, dimEmployeeTo, dimLocationTo, dimRetailStoresTo, dimVendorTo; #File dialog = new Dialog("Pick the file"); dfFileName = dialog.addField(extendedTypeStr("FilenameOpen")); dialog.filenameLookupFilter(['csv','*.csv']); if (dialog.run()) { csvFile = new CommaTextIo(dfFileName.value(), 'r'); csvFile.inFieldDelimiter(','); readCon = csvFile.read(); while(csvFile.status() == IO_Status::OK) { readCon = csvFile.read(); if(readCon) { inventJournalTable.JournalId = conPeek(readCon,1); itemId = conPeek(readCon,2); inventJournalTrans.clear(); inventJournalTrans.initFromInventJournalTable(inventJournalTable); inventJournalTrans.ItemId = itemId; frominventDim.InventSiteId= conPeek(readCon,3); frominventDim.InventLocationId= conPeek(readCon,4); frominventDim.wMSLocationId = conPeek(readCon,5); fromInventDim.InventSizeId = conPeek(readCon,6); fromInventDim.InventColorId = conPeek(readCon,7); fromInventDim.configId = conPeek(readCon,8); fromInventDim.InventStyleId = conPeek(readCon,9); ToinventDim.InventSiteId= conPeek(readCon,10); ToinventDim.InventLocationId= conPeek(readCon,11); ToinventDim.wMSLocationId = conPeek(readCon,12); ToinventDim.InventSizeId = conPeek(readCon,13); ToinventDim.InventColorId = conPeek(readCon,14); ToinventDim.configId = conPeek(readCon,15); ToinventDim.InventStyleId = conPeek(readCon,16); //ToinventDim.InventLocationId = "SD"; //ToInventDim.wMSLocationId = '11_A2'; //ToInventDim.InventSizeId = '1000'; //ToInventDim.inventBatchId = 'T20/0001/1'; ToinventDim = InventDim::findOrCreate(ToinventDim); frominventDim = InventDim::findOrCreate(frominventDim); inventJournalTrans.InventDimId = frominventDim.inventDimId; inventJournalTrans.initFromInventTable(InventTable::find(itemId)); inventJournalTrans.Qty = conPeek(readCon,17); inventJournalTrans.ToInventDimId = ToinventDim.inventDimId; //inventJournalTrans.CostAmount = InventJournalTrans.calcCostAmount(-abs(any2real(strReplace((strFmt('%1',inventJournalTrans.Qty))),',','.')))); //inventJournalTrans.CostAmount = InventJournalTrans.calcCostAmount(inventJournalTrans.Qty); inventJournalTrans.CostPrice = conPeek(readCon,18); inventJournalTrans.CostAmount = conPeek(readCon,19); dimcustomerFrom = conPeek(readCon,20); dimDepartmentFrom = conPeek(readCon,21); dimEmployeeFrom = conPeek(readCon,22); dimLocationFrom = conPeek(readCon,23); dimRetailStoresFrom = conPeek(readCon,24); dimVendorFrom = conPeek(readCon,25); inventJournalTrans.TransDate = str2Date(conpeek(readCon, 26), 213); //conPeek(readCon,26); //dimcustomerTo = conPeek(readCon,26); //dimDepartmentTo = conPeek(readCon,27); //dimEmployeeTo = conPeek(readCon,28); //dimLocationTo = conPeek(readCon,29); //dimRetailStoresTo = conPeek(readCon,30); //dimVendorTo = conPeek(readCon,31); conAttr = ["Customer", "Department", "Employee", "Location", "RetailStores", "Vendor"]; conValue = [dimcustomerFrom, dimDepartmentFrom, dimEmployeeFrom, dimLocationFrom, dimRetailStoresFrom, dimVendorFrom]; //conLedgerDimension = ["Customer", "Department", "Employee", "Location", "RetailStores", "Vendor"]; inventJournalTrans.LedgerDimension = 0; for (i = 1; i <= conLen(conAttr); i++) { dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i)); if (dimensionAttribute.RecId == 0) { continue; } dimValue = conPeek(conValue,i); if (dimValue != "") { dimensionAttributeValue = dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true); valueSetStorage.addItem(dimensionAttributeValue); } } result = valueSetStorage.save(); inventJournalTrans.DefaultDimension = result; inventJournalTrans.JournalType = InventJournalType::Transfer; inventJournalTrans.insert(); } } } info("Imported Successfully"); //inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckpostType::Post,inventJournalTable); //inventJournalCheckPost.parmThrowCheckFailed(1); //inventJournalCheckPost.parmShowInfoResult(1); //inventJournalCheckPost.run(); }

Import data through CSV in AX2012

static void ADUpdateInventTable(Args _args) { CommaTextIO csvFile; container readCon; Dialog dialog; DialogField dfFileName; FileName fileName; InventTable inventTable; ItemId itemId; //DirPartyContactInfoView contactView; #File dialog = new Dialog("Pick the file"); dfFileName = dialog.addField(extendedTypeStr("FilenameOpen")); dialog.filenameLookupFilter(['csv','*.csv']); if (dialog.run()) { csvFile = new CommaTextIo(dfFileName.value(), 'r'); csvFile.inFieldDelimiter(','); readCon = csvFile.read(); while(csvFile.status() == IO_Status::OK) { readCon = csvFile.read(); if(readCon) { itemId = conPeek(readCon,1); ttsBegin; select forUpdate inventTable where inventTable.ItemId == itemId; if(inventTable.Test == NoYes::Yes) { inventTable.Test = NoYes::No; inventTable.update(); } ttsCommit; info(itemId); } } } }