code change · fixIntegration & APIsofficial - Microsoftreviewed - checked by Opus

#13627 [E-Documents] Fix division by zero importing zero-amount purchase order lines

E-Document import now correctly handles zero-amount purchase order lines by preventing division-by-zero errors when calculating discount percentages.

Pull request · merged into main (BC30) on 2026-11-13 by gggdttt · 2 files (+79 -1), 1 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • Guard denominator in discount percentage calculation to prevent division by zero on zero-amount lines
  • Set imported discount percentage to zero when denominator is zero while preserving existing calculation for nonzero cases
  • Added six regression tests covering nine input combinations including zero/nonzero amounts and discounts
  • No schema, API, permission, or upgrade changes required
  • Preserves behavior for all nonzero-denominator scenarios including negative amounts
  • Behaviour changes for users or extensions.

AL objects touched

Context

  • Work items: AB#654114
  • Labels: AL: Apps (W1), Team: Integrations
  • Systems: integration
  • From the description: “Guard the denominator and explicitly set the imported discount percentage to zero when it is zero.”

No source states these links: they share an object, a model read them, or a person found the same subject.

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).