Your issue stems from how custom data entities bypass the standard pricing workflow. When manual entry applies pricing correctly but imports don’t, it indicates the entity isn’t invoking the pricing engine’s evaluation chain.
Here’s what you need to address for each focus area:
Custom Data Entity Configuration:
Your entity needs to explicitly call the pricing calculation service in the insertEntityDataSource method. Add this after line creation:
PriceDiscAdmSearch::findPrice(salesLine);
PriceDisc::findDisc(salesLine);
These two calls trigger the complete pricing evaluation chain including tiered pricing rules.
Manual Entry vs Import Behavior:
The UI form uses the SalesLine.modifiedField() event which automatically triggers pricing. Your data entity bypasses this entirely. You need to simulate this behavior by calling salesLine.setPriceAgreement() before the pricing search methods above.
Tiered Pricing Rules Configuration:
Verify your price agreements have the “Find next” option enabled in the pricing management module. This ensures the engine evaluates all tier breaks. Also confirm the data entity sets these fields in order: 1) Customer account, 2) Item number, 3) Quantity, 4) Pricing date. The sequence matters because the pricing engine uses these as search parameters.
Additional Considerations:
Set validateWrite to call super() first, then add pricing validation. Ensure your XML mapping includes the InventDimId field - the pricing engine needs dimension context for proper tier evaluation. If using price groups, verify the import sets the customer’s price group before line creation.
The skipDataMethods property on your entity should be false. If it’s true for performance, you’ll need a post-processing step that explicitly recalculates all pricing using a batch job that calls the PriceDiscAdmSearch class for each imported line.
Test with a small batch first to confirm the pricing logic executes correctly before scaling to full production imports.
This draft is based on general Microsoft Dynamics 365 knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.