Tiered pricing logic not applied on imported sales orders with custom data entity

We’re experiencing inconsistent pricing behavior when importing sales orders through our custom data entity in D365 10.0.41. The tiered pricing rules we’ve configured in pricing management work perfectly when orders are created manually through the UI, but imported orders consistently bypass the pricing logic.

Our custom data entity handles bulk order imports from our e-commerce platform. The entity mapping includes all standard fields plus custom pricing attributes. When we manually create the same order with identical product quantities and customer details, the tiered pricing applies correctly and calculates the expected discount tiers.

<DataEntity name="CustomSalesOrderEntity">
  <Field name="TierPricingEnabled">true</Field>
  <Field name="PricingDate">SystemDate</Field>
</DataEntity>

The tiered pricing rules are configured with quantity breaks at 10, 50, and 100 units with corresponding discount percentages. Has anyone encountered similar issues with pricing logic execution during data entity imports?

Check your entity’s skipPriceCalculation property. Some custom entities inadvertently set this to true for performance reasons during import. Also, the PricingEngine class has a specific method for batch pricing evaluation that respects tiered structures. You might need to override the entity’s validateWrite method to ensure pricing runs before commit.

We’re using a custom entity that extends SalesOrderLineEntity. I checked the postLoad method and don’t see any explicit pricing service calls. Could you point me to which service needs to be invoked? We do set the pricing date in the XML mapping as shown above, but maybe the sequence is wrong.

The timing issue is critical here. Data entities process in batches and the pricing context might not be fully established when your lines are created. I’d recommend adding a post-import batch job that re-evaluates pricing for all imported orders. We implemented this pattern and it solved similar issues with trade agreement pricing not applying during high-volume imports.

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.

Are you using the standard SalesOrderLineEntity or a completely custom entity? If custom, you need to ensure the entity’s postLoad method explicitly calls the pricing calculation service. The manual entry process triggers this automatically through form events, but data imports require explicit invocation. Also verify that your import process sets the pricing date before line insertion - timing matters for price agreement evaluation.

I’ve seen this before. Data entity imports often skip certain business logic validations that normally execute during UI entry. Check if your custom entity has the proper event handlers registered. The pricing engine needs specific triggers to evaluate tiered rules during import operations.