• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
  • Recommended Readings
    • 2022 Book Reading
    • 2023 Recommended Readings
    • Book Reading 2024
    • Book Reading 2025
  • Supply Chain Management Guide
  • PKM
  • Microsoft Excel

Ali Raza Zaidi

A practitioner’s musings on Dynamics 365 Finance and Operations

Dynamics 365 for finance and operations

Sales price and discount is not added to sales line X++

May 26, 2025 by alirazazaidi

I encountered this issue and, during troubleshooting, I discovered that the system performs an update on the sales line to retrieve sales prices and discounts. This process has a performance impact. In fact, the prices are copied from the trade agreement in Dynamics 365 for Finance and Operations

For manual price use following code snippet

 salesLine.initFromInventTable(InventTable::find(salesLine.ItemId));
 salesLine.InventDimId = inventDim.inventDimId;
                        
                        
 salesLine.SalesQty = listObject.parmSalesQty();
 salesLine.SalesPrice = listObject.parmOriginalPrice();


 salesLine.SalesUnit = _InventItemBarcode.UnitID;
 salesLine.PriceUnit = 1.00;

 if ( (listObject.parmOriginalPrice() >= listObject.parmOfferPrice()) && !(listObject.parmOfferPrice() <0) && !(listObject.parmOriginalPrice() <=0))
 {
     if (listObject.parmOfferPrice()!=0)
     {
         real _Discount =listObject.parmOriginalPrice() -listObject.parmOfferPrice();
         salesLine.LineDisc = _Discount;
     }
     else
     {

         salesLine.LineDisc = 0;
     }
 }
 salesLine.DefaultDimension =LedgerDimensionDefaultFacade::serviceMergeDefaultDimensions(salesTable.DefaultDimension,InventTable::find(salesLine.ItemId).DefaultDimension);
 salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, SalesPrice));
 salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, LineDisc));
// salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, LinePercent));
 salesLine.setPriceDiscChangePolicy(PriceDiscSystemSource::ManualEntry, fieldNum(salesLine, PriceUnit));


 Try
 {
     ttsbegin;
     salesLine.CreateLine(NoYes::Yes,NoYes::Yes);
ttscommit;
}
catch
{}


How to fetch un-Invoiced Delivery notes for sales order – D365 Finance and Operations

March 1, 2025 by alirazazaidi

So here is another code snippet, that I develop after two hours of testing and understanding the D365 F&O that get all non invoiced , delivery notes or packingslip. I want to restrict the code to invoice against Delivery note, If no non posted delivery note exists, Code will not generate the invoice.

 public static str getUninvoicedPackingSlipsBySalesId(SalesId _salesId)
 {
     CustPackingSlipJour custPackingSlipJour;    // Packing slip journal
     InventTrans         inventTrans;            // Inventory transaction

     str packingSlipIds = "";
     container distinctPackingSlips;             // Container to store unique Packing Slip IDs
     int i = 0;

     // Fetch only un-invoiced Packing Slips based on Sales ID
     while select inventTrans
     where inventTrans.InvoiceId == ""
     
     join custPackingSlipJour
     where custPackingSlipJour.PackingSlipId == inventTrans.PackingSlipId
       && custPackingSlipJour.SalesId == _salesId
     {
         // Check if the Packing Slip ID is already in the container
         if (conFind(distinctPackingSlips, custPackingSlipJour.PackingSlipId) == 0)
         {
             distinctPackingSlips += custPackingSlipJour.PackingSlipId;  // Add to container if unique
                          
         }
     }

     return con2Str(distinctPackingSlips);  // Return the comma-separated string or empty if none found
 }

How to Import Data into D365 Finance and Operations

February 23, 2025 by alirazazaidi

Hello friends, welcome to today’s video/blog post!

In this guide, we will walk through the process of loading data into Dynamics 365 Finance and Operations (D365 F&O). This step is typically performed twice:

  1. During initial environment configuration – before starting the User Acceptance Testing (UAT).
  2. Before going live – to ensure all required business data is in place.

Data Collection and Preparation

After analyzing business requirements, the Functional Consultant collects data from Business Users. There are two common approaches for preparing data:

  1. Business Users Provide Data in Excel
    • The business users share their data in Excel files.
    • The functional consultant then transforms it into the required D365 template for import.
  2. Predefined D365 Templates
    • The functional consultant exports predefined Excel templates from D365 F&O.
    • These templates are shared with business users for data entry.
    • Once completed, the business users upload the data into the system.
Excel Expertise is Essential

From my experience, strong Excel skills are crucial when handling data imports. You’ll often need to:

  • Remove duplicates.
  • Replace lookup values with valid data.
  • Ensure data is formatted correctly before uploading.

However, delays can occur due to confusion over responsibility. Business users may not provide data in the required format, while functional consultants may hesitate to modify it. This can result in delays of two weeks to a month in some cases.

Data Import Methods in D365

Microsoft provides two ways to import data into D365 Finance and Operations, both based on the D365 Data Entity Framework:

  1. Data Entity Framework – Used to import/export structured data.
  2. Excel Add-in – Allows direct data updates from Excel into D365.

Step-by-Step Guide to Import Data

In this walkthrough, we will use both methods to import data into D365 F&O.

Step 1: Exporting a Data Template
To get started, we first need to export a data template from D365. Here’s how:

  1. Navigate to the Dashboard.
  2. Click on Data Management.

Second way to go System administrator and there you can go Data Management
System Administration > Workspaces > Data management.

From Title Click and select Export

Create a new group and add vendor Info. and then click on Add entity

Search and select Vendors v2 in entity name and then select Excel in Target data format

Click on Export now

download excel by click on download excel file. Our excel template is ready.

We can remove unnessary fields from here and remove existing data and add new vendor information in excel sheet.

When excel sheet is prepared click again on Data management workspace on import Title

Create a new group with Vendor Import v2

click on add file and select Excel

and then search and select vendor V2 from form entity Name.

select the file and upload

Load and upload modified excel sheet and click on close button.

Before going to import go to vendor number sequence and set it manual and allow to a higher number.

And click on import

It is successful. If there are issue, then we try to resolve any validation issue. and try to import again.

![[Pasted image 20250223162113.png]]

Excel Addin

Using the Excel Add-in to Load Data into D365 F&O

Another efficient way to load data into D365 Finance and Operations (D365 F&O) is by using the Excel Add-in. This method allows users to import and update records directly from Excel, streamlining the data entry process.

Steps to Load Vendor Data Using the Excel Add-in

  1. Navigate to the Vendor List Page
    • Go to Accounts Payable > Vendors > All Vendors.
    • This page displays the list of all vendors in the system.
  2. Open the Excel Add-in
    • Click on the Microsoft Office icon in the top-right corner of the screen.
    • Select Vendor V2 under Open in Excel.

Work with the Excel Template

  • The system will download an excel file with all required fields.
  • Need to enable the Microsoft Dynamics Add-in if prompted.

Add new vendor and drag table boarder to new line save it
Publish the Data to D365

  • Once the data is entered, click the Publish button in the Excel Add-in.
  • The data will be validated and imported directly into D365 F&O.

click on publish

You can see the uploaded data into D365 F&O

How write a simple dialog for input In D365 Finance and Operations X++

September 1, 2024 by alirazazaidi

What a difference between RunBase and RunBaseBatch.

RunBase is used to create dialog. While runBaseBatch can be used to set dialog box as batch job.

/

Today I have a simple tip. that help you to create a input box to get values. this class will create a dialog box. You can use this to replace your runable class logic.


class RequestCopyJob extends RunBase
{
DialogField fieldInvoice;
DialogField fieldName;

// Variables to store user input

CustomerInvoiceId _InvoiceId;

// pack() and unpack() methods are used to load the last value from user
// for our simple example we are not going to use them.
public container pack()
{
return conNull();
}

public boolean unpack(container packedClass)
{
return true;
}

public Object dialog()
{
Dialog dialog = super();

// Set a title for dialog
dialog.caption( ‘Simple Dialog’);

// Add a new field to Dialog
fieldInvoice = dialog.addField(extendedTypeStr(DSACustomerInvoiceId), ‘Invoice’);

return dialog;
}

public boolean getFromDialog()
{
_InvoiceId = fieldInvoice.value();
return super();
}

public void run()
{
// Set Dialog field value to find CustTable

EInvoiceServiceRequests _EInvoiceServiceRequest;

select forupdate * from _EInvoiceServiceRequest where _EInvoiceServiceRequest.CustomerInvoiceId ==_InvoiceId;
ttsbegin;
_EInvoiceServiceRequest.ResponseStatus = ServiceStatus::SUCCESS;
_EInvoiceServiceRequest.update();
ttscommit;

}

public static void main(Args _args)
{
RequestCopyJob Job = new RequestCopyJob();
// Prompt the dialog, if user clicks in OK it returns true
if (Job.prompt())
{
Job.run();
}
}

}

Json empty string to Null D365 finance and operations

June 10, 2024 by alirazazaidi

Small tip today

str myJson = FormJsonSerializer::serializeClass(sContract);
        myJson = strReplace(myJson,":"",",": null,");
        return myJson;

Like this

Prepayment for Purchase order step by Step D365 Finance and Operations

June 8, 2024 by alirazazaidi

In this video I shared how you can configure prepayment for purchase order and how we can settle it with purchase Invoice.

Where is admin Provisioning tool in 10.0.39. vm

May 31, 2024 by alirazazaidi

  • Where is admin Provisioning tool in 10.0.39.
  • I just download the 10.0.39 vm form LCS.
  • Microsoft just upload the vm on lcs on 29 May 2024
  • After download and extract and configuration.
  • I found admin provision tool is missing from desktop.
  • I found this admin provision tool exe in following folder
  • C:\AOSServicePackagesLocalDirectory\bin

Fix “The permission ‘KILL DATABASE CONNECTION’ is not supported in this version of SQL Server” while importing a D365FO .bacpac (10.0.39

May 30, 2024 by alirazazaidi

  • Kill database issue in database restore
    • Download two set of .backpac or move one copy into you vm.
    • change the extension of .backpac to zip.
    • Extract it or if you dont have space just open it in Zip or winrar.
    • Copy only model.xml in your local hard drive.
    • Open it in notepad++
    • Search and remove all nodes Grant.KillDatabaseConnection.Database
    • Save the xml file.
    • Delete the extracted zip file.
    • Copy the extracted and modified model.xml into same folder where you place the .backpac in your vm Hard drive.
    • Apply the same command with additional key words /ModelFilePath (/mfp)
    • mfp means file path model.
    • The complete file will be look like
    • SqlPackage.exe /a:import /sf:c:\\temp\\BabaKaTullo.bacpac /tsn:localhost /tdn:axdb5 /p:CommandTimeout=500000 /ttsc:True /ModelFilePath:G:\\Temp\\model.xml

Relation between VendPackingSlipTrans and VendInoiceTRans D365 Finance and Operation

May 27, 2024 by alirazazaidi

One of my young colleuge needs a query so he can get packingslip line agains vend inoice trans. He was developing some report for procurement and sourcing.

I found my documentation about something similar almost 9 years ago.

Relation between VendPackingSlipTrans and VendInoiceTRans Dynamics Ax 2012

But a lot of things change from Ax 2012 to d365 Finance and operations.

Now if you required something similar following query will work.

VendInvoicePackingSlipQuantityMatch vendInvoicePackingSlipQuantityMatch;
        VendPackingSlipTrans vendPackingSlipTrans;

        select firstonly vendPackingSlipTrans
            exists join vendInvoicePackingSlipQuantityMatch
                where vendInvoicePackingSlipQuantityMatch.InvoiceSourceDocumentLIne == VendPackingSlipTrans.SourceDocumentLine &&
                      vendPackingSlipTrans.SourceDocumentLine == vendInvoicePackingSlipQuantityMatch.PackingSlipSourceDocumentLine;

Job types 101 Asset Management in D365 Finance and Operations. Asset Management Part 2

August 6, 2023 by alirazazaidi

Hello, everyone. This is the second post in the Enterprise Asset Management Series.

In my last post, I shared some insider information and my understanding of locations in Asset Management. You can find that post at the link below.

In this post, we will discuss the following things:

  1. Maintenance job categories.
  2. Maintenance job types variants.
  3. Maintenance job types.
  4. Maintenance checklist template.
  5. Setup default checklist on job type.

Maintenance job Categories:

Categories are used to group Job types. We can identify these job types with category types.

Navigation

Asset Management > Setup > Job > Maintenance job type categories

Maintenance Job Types Variants

This is a non-essential setup requirement. Just to provide the extra information and possible need for more care required for maintenance. For example, Condition Assessment at 1000 Km or 2000 km is possible for technicians to verify or diagnose in more detail as compared to 1000 km if Job type variations exist.

Navigation

Asset Management > Setup > Job > Maintenance job type variants

Maintenance job types.

One of the major central points of Asset management is the common template, where we need to define things that are copied to work orders.

In the Details sections, we just have counters; these counters are the result of the below tabs or sections.

In this section, we can define the job category and also mention that this type of job requires downtime activities.

Then comes the description.

In this field, you can define and note anything you want to store as details.

Then come Job variants,

In this section, we defined the Job variants; these variants will be shown when we select job types on a work order. What we define here will reflect on the work order Type. The Job variant will populate based on the job type.

Job skills and Job certificates are unimportant and less used features. They can be defined, but they will never be used. It is just information.

The next critical step is to complete the maintenance job successfully.

Where we define, next job after completing jobs. these were just information, I did not found any benefit to define succeeding maintenance jobs.

Now comes with Asset Types. In this section we defined qualified asset types on this job type are allowed.

When we define a work order against an asset, on the selection of the asset, the drop-down shows only assigned job types in the above-mentioned job type.

This will be one of the most important points in the whole maintenance job type.

Maintenance Job Defaults:

If you click on the action pane, then Maintenance Job Type, a new form will open.

where we can define different check lists, forecasts, descriptions, and resources for the default job type.

We can also add multiple defaults based on variations in the combination of job type and asset type. The same job type can work for different types of assets. We defined the asset type in the above-mentioned step, in Asset Type.

For current example, which mostly from contoso data and usmf legal entity, You can see Hours are 1.00. If I click on forecast button on fast tab

You will find something similar. You can see that the forecast method has already defined an hour.

There are complete details on Item forecast, and in the same way, we can define expense forecast and fee forecast.

Most of the time, we used to set expenses for technician work, food he took during maintenance work, or travel expenses we had to give to the technician for each. In the fee section, most of the time we record the outsourced service charges. It depends on how you plan.

This forecast is important; when we post the actual journal, the comparison between forecast and actual will come from here.

I will probably discuss this in my next blog post.

Here We have to define a maintenance checklist. We can assign these maintenance check lists to job types. When we define a work order for a specific job type, the check list defined for that job type defaults to it.

These check lists will be used for verification of maintenance or to ensure that technicians will perform all necessary maintenance.

Check lists can now be defined as different check lists. These check lists are used to verify what type of test we have to define for each asset type.

We can define, new check list with help of following options.

Text is used for the just-mentioned answer.

The header is used to create a separator between questions; they appear in the same way they are defined as per line number.

Variables are usually Yes, no, or multiple choice answer; most of the time, it will be used for two values: “True” and “False”.

Then comes measurement, which will be used for numeric values. for example, vehicle use counter, and then there is range, which can also be defined here.

Template: here we define the template. I used to prefer this because, in this way, we can define templates Independently and reuse them later.

We can create a new maintenance check list by click on new button.

Or you can define, check lists in following navigation. These reusable check list can be select in above link.

Navigation >setup >Maintenance checklist > Maintenance checklist templates

In this we define Job type, And all things defined here will be reuse in work order.

Hope you like this post,

Next Page »

Primary Sidebar

About

I am Dynamics AX/365 Finance and Operations consultant with years of implementation experience. I has helped several businesses implement and succeed with Dynamics AX/365 Finance and Operations. The goal of this website is to share insights, tips, and tricks to help end users and IT professionals.

Legal

Content published on this website are opinions, insights, tips, and tricks we have gained from years of Dynamics consulting and may not represent the opinions or views of any current or past employer. Any changes to an ERP system should be thoroughly tested before implementation.

Categories

  • Accounts Payable (2)
  • Advance Warehouse (2)
  • Asset Management (3)
  • Azure Functions (1)
  • Books (6)
  • Certification Guide (3)
  • Customization Tips for D365 for Finance and Operations (62)
  • D365OF (59)
  • Data Management (1)
  • database restore (1)
  • Dynamics 365 (58)
  • Dynamics 365 for finance and operations (135)
  • Dynamics 365 for Operations (165)
  • Dynamics AX (AX 7) (134)
  • Dynamics AX 2012 (274)
  • Dynamics Ax 2012 Forms (13)
  • Dynamics Ax 2012 functional side (16)
  • Dynamics Ax 2012 Reporting SSRS Reports. (31)
  • Dynamics Ax 2012 Technical Side (52)
  • Dynamics Ax 7 (65)
  • Exam MB-330: Microsoft Dynamics 365 Supply Chain Management (7)
  • Excel Addin (1)
  • Favorites (12)
  • Financial Modules (6)
  • Functional (8)
  • Implementations (1)
  • Lifecycle Services (1)
  • Logseq (4)
  • Management Reporter (1)
  • Microsoft Excel (4)
  • MS Dynamics Ax 7 (64)
  • MVP summit (1)
  • MVP summit 2016 (1)
  • New Dynamics Ax (19)
  • Non Defined (9)
  • Note taking Apps (2)
  • Obsidian (3)
  • Personal Knowledge Management (2)
  • PKM (13)
  • Power Platform (6)
  • Procurement (5)
  • procurement and sourcing (5)
  • Product Information Management (4)
  • Product Management (6)
  • Production Control D365 for Finance and Operations (10)
  • Sale Order Process (10)
  • Sale Order Processing (9)
  • Sales and Distribution (5)
  • Soft Skill (1)
  • Supply Chain Management D365 F&O (3)
  • Tips and tricks (278)
  • Uncategorized (165)
  • Upgrade (1)
  • Web Cast (7)
  • White papers (4)
  • X++ (7)

Copyright © 2025 · Magazine Pro On Genesis Framework · WordPress · Log in