D365/AX7: Uninstall/Remove a Model/Package From Production & UAT Environment


Uninstall/Remove a Model/Package From Production & UAT Environment of Microsoft Dynamics Finance and operations.


  1. Create a file that is named ModuleToRemove.txt.
  2. In the file, put the name of each module that you want to remove on a separate line. Make sure that you’ve completed the prerequisites for each module that you’re removing.
  3. Create a valid deployable package, and put the ModuleToRemove.txt file in the package\AOSService\Scripts folder.
  4. Install/Deploy the deployable package in UAT or production environment.
  5. Verify that the package was uninstalled before you complete this procedure in a production environment.

Azure Fundamentals: IaaS (Infrastructure as a service) vs SaaS (Software as a service) vs PaaS ( Platform as a service)

Azure Fundamentals: IaaS (Infrastructure as a service) vs SaaS (Software as a service) vs PaaS ( Platform as a service)

Upfront costsNo Upfront costs Users pay only for what they consume.No Upfront costs Users pay only for what they consume.No Upfront costs Users pay only for subscriptions.
User ownershipUser is resposible for software, operating systems, middleware, data and applications.User is responsible for data and applicationsUsers just use the application software; they are not responsible for any maintenance or management of that software.
Cloud provider ownershipHardwares, network etc.Cloud providers are typically responsible for everything except Data & applicationCloud providers are typically responsible for everything including Data & application
Commonly used scenariosStorage, backup, and recovery/Test and developmentAzure Logic AppsD365 Online/Skype

Azure Fundamentals : Virtual Machines vs Containers vs Serverless Computing

Virtual Machine is like a computer created within a computer.It has guest operating system. Virtual Machine uses hardware level virtualization.Hypervisor controllers enables you to create and run multiple VMs.

Containers virtualizes entire operating system and multiple applications runs in an isolated and secure way on a single operating system.It doesn’t have any guest operating system.The application and all its dependencies is packaged into a “container” and then a standard runtime environment is used to execute the app.

Serverless computing also called as FaaS (Function as a service). Azure Function and AWS Lambda are the most popular serverless platforms.Application is broken into separate functions that run when triggered by some action.You only pay for the processing time used by each function as it executes.


Piyush Adhikari

D365/AX7: Computed Column/Field In View Using Method & SQL Statements


Adding a Computed Column/Field In View Using Method & SQL Statements.

Sample Code

  1. Add a new method “Computed” in your view.You can fully utilize SQL case statements, SQL Functions, SQL direct statements as per your requirements.Untitled
  2. Add a new string computed column or field in your view.Capture
  3. Change the property of computed column and select your method name in “View Method” property.Untitled
  4. Build and Synchronize the project.Your view is now ready to use.
  5. You SQL View should look like this.UntitledCheers …Piyush Adhikari

D365/AX7: Debug Batch Jobs In Visual Studio Using Process batch.exe


There are many process in Microsoft Dynamics 365 Finance and Operation which run in background as a batch jobs. The Debugging of Batch Jobs In Visual Studio is very common requirement.


  1. Go the Debug Menu & Click on “Attach To Process”.Untitled
  2. Show process from all users should be selected  YES
  3. Attach To Value should be -Automatic: Managed (v4.6, v4.5, v4.0) code
  4. Select Process “Batch.exe” from available processes & run your batch job. Breakpoint will hit and you will be able to debug your code.Untitled

AX7/D365: JSON DeSerialization/Parsing Using FormJsonSerializer


Developer is consuming an external REST web-service in D365/X++ . Response is in the JSON format.  Developer needs to DeSerialize incoming JSON so that values can be used later in the system.

Sample Code:

  1. Create a contract class
    class JSONContract
        String50 parmFirst, parmSecond;
        public String50 parmFirst(String50 _parmFirst = parmFirst)
            parmFirst = _parmFirst;
            return parmFirst;
        public String50 parmSecond(String50 _parmSecond = parmSecond)
            parmSecond = _parmSecond;
            return parmSecond;
  2. Sample Class
    class RunnableClassABC
        /// <summary>
        /// Runs the class with the specified arguments.
        /// </summary>
        /// <param name = "_args">The specified arguments.</param>
        public static void main(Args _args)
            str             json;
            List            values = new List(Types::String);
            ListEnumerator  value;      
            json = '[{"FieldValues": [{"parmFirst": "ValueFirst", "parmSecond": "ValueSecond", "parmList":[{"parmFirst": "ValueFirst", "parmSecond": "ValueSecond"}] }]}]';
            // Deserializing Json
            values = FormJsonSerializer::deserializeCollection(classnum(List), json, Types::Class, classStr(JSONContract));
            value = values.getEnumerator();
                JSONContract    JSONContractCurrent = value.current();
                info(strFmt("%1    %2",JSONContractCurrent.parmFirst(), JSONContractCurrent.parmSecond()));

D365/AX7: Create Inventory Movement Journal Using X++ Code

public static void main(Args _args)
InventTable inventTable;
InventSite inventSite;
InventJournalTrans inventJournalTrans;
InventDim inventDimFrom;
InventJournalTable inventJournalTable;
int lineNum;
InventParameters inventParameters = InventParameters::find();
if (inventJournalTable.validateField(fieldNum(InventJournalTable, JournalNameId)))
inventJournalTable.modifiedField(fieldNum(InventJournalTable, JournalNameId));
inventJournalTable.JournalType = InventJournalType::Movement;

lineNum ++;
inventJournalTrans.TransDate = today();
inventJournalTrans.ItemId = '1104X';
inventJournalTrans.LineNum = lineNum;
inventJournalTrans.modifiedField(fieldNum(InventJournalTrans, ItemId));
inventDimFrom.InventSiteId = 'Site 1';
inventDimFrom.InventLocationId = '11';
inventDimFrom = InventDim::findOrCreate(inventDimFrom);
inventJournalTrans.InventDimId = inventDimFrom.inventDimId;
inventJournalTrans.modifiedField(fieldNum(InventJournalTrans, inventDimId));
inventJournalTrans.Qty = 2;
inventJournalTrans.modifiedField(fieldNum(inventJournalTrans, Qty));
inventTable = InventTable::find(inventJournalTrans.ItemId);
inventJournalTrans.DefaultDimension = LedgerDimensionDefaultFacade::serviceMergeDefaultDimensions(inventTable.DefaultDimension, inventDimFrom.inventSite().DefaultDimension);
inventJournalTrans.JournalType = InventJournalType::Movement;

D365/AX7: Calculate On Hand Stock Of Item Using X++ & Code

public static void main(Args _args)
InventDimParm inventDimParm;
InventDim inventDim; 
Qty availPhysicalCalculated; ;
inventDim.InventLocationId = 'MLT-WH';
inventDim = InventDim::findOrCreate(inventDim);
availPhysicalCalculated = InventSum::findSum("ALLOY",inventDim,inventDimParm).availPhysicalCalculated();
info(strfmt("availPhys:%1 ",availPhysicalCalculated));

D365/AX7: X++ Code To Create Item or Released Product Using Data Entity EcoResReleasedProductCreationV2Entity


X++ Code To Create Item or Released Production Using Data Entity EcoResReleasedProductCreationV2Entity

Sample Code

class CreateReleasedProduct
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
EcoResReleasedProductCreationV2Entity ecoResReleasedProductCreationV2Entity;

ecoResReleasedProductCreationV2Entity.ItemNumber = '1104X';
ecoResReleasedProductCreationV2Entity.ItemModelGroupId = 'Stocked';
ecoResReleasedProductCreationV2Entity.InventoryUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.BOMUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.ProductGroupId = 'FG';
ecoResReleasedProductCreationV2Entity.ProductType = EcoResProductType::Item;
ecoResReleasedProductCreationV2Entity.ProductNumber = '1104X';
ecoResReleasedProductCreationV2Entity.ProductSearchName = '1104X';
ecoResReleasedProductCreationV2Entity.ProductName = '1104X';
ecoResReleasedProductCreationV2Entity.TrackingDimensionGroupName = 'None';
ecoResReleasedProductCreationV2Entity.ProductSubType = EcoResProductSubtype::Product;
ecoResReleasedProductCreationV2Entity.SearchName = '1104X';
ecoResReleasedProductCreationV2Entity.SalesUnitSymbol = 'ea';
ecoResReleasedProductCreationV2Entity.StorageDimensionGroupName = 'SiteWH';
ecoResReleasedProductCreationV2Entity.PurchaseUnitSymbol = 'ea';



D365/AX7: Inventory Registration & Un-Registration Using X++ Class InventTransWMS_register

Hey Visitors,

Here is the sample code for Inventory Registration & Un-Registration Using X++ Class InventTransWMS_register.


piyush adhikari – +91-7995802472

public static void operations(PurchId _purchId)
PurchLine purchLine;
InventTrans inventTrans;
InventDim inventDim;
InventTransWMS_Register inventTransWMS_register;
TmpInventTransWMS tmpInventTransWMS;

while select RecId, InventTransId from purchLine
where purchLine.PurchId == _purchId
&& purchLine.IsDeleted == NoYes::No
&& purchLine.PurchQty > 0
inventTrans = InventTrans::findTransId(purchLine.InventTransId);
if(inventTrans && inventTrans.StatusReceipt != StatusReceipt::Registered)
inventDim = inventTrans.inventDim();
tmpInventTransWMS.InventQty = inventTrans.Qty;
tmpInventTransWMS.InventDimId = inventDim.inventDimId;

inventTransWMS_register = inventTransWMS_register::newStandard(tmpInventTransWMS);
inventTransWMS_Register.createFromInventTrans(inventTrans, inventDim);
inventTransWMS_register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, inventDim);