Skip to content

Comments

[Shopify] Shopify Order Number as Document Number#6721

Open
GediminasGaubys wants to merge 2 commits intomicrosoft:mainfrom
GediminasGaubys:dev/aan/shopifyorderno
Open

[Shopify] Shopify Order Number as Document Number#6721
GediminasGaubys wants to merge 2 commits intomicrosoft:mainfrom
GediminasGaubys:dev/aan/shopifyorderno

Conversation

@GediminasGaubys
Copy link
Contributor

Implementation Description - Shopify Order Number as Document Number

Summary

This PR introduces a configurable option to use Shopify order numbers as document numbers for Sales Orders and Sales Invoices in Business Central, enabling consistent order identifiers across both systems and improving traceability.

Changes

New Functionality:

  1. Configuration Setting in Shop Card:

    • Added "Use Shopify Order No." field to Shpfy Shop table (field 136) and Shpfy Shop Card page.
    • When enabled, Shopify order numbers become the document numbers for created Sales Orders and Sales Invoices.
  2. Order-Level Override:

    • Added "Use Shopify Order No." field to Shpfy Order Header table (field 135) and Shpfy Order page.
    • Field is editable only when the order hasn't been processed yet.
    • Allows per-order override of the shop-level setting.
  3. Document Number Assignment Logic:

    • Modified ShpfyProcessOrder codeunit to assign Shopify order number when the feature is enabled.
    • Applies to both Sales Orders and Sales Invoices.
  4. Character Validation:

    • Validates that Shopify order numbers don't start with "@" character.
    • Prevents document creation failures due to BC's document number constraints.
  5. Order Import Integration:

    • Modified ShpfyImportOrder codeunit to propagate shop settings to imported orders.
    • Sets OrderHeader."Use Shopify Order No." := Shop."Use Shopify Order No." during import.

Prerequisites:

  • Number Series Configuration: Sales Order and Sales Invoice number series must have "Manual Nos." enabled to accept Shopify order numbers.
  • Shopify Connector Setup: Connector must be configured with valid shop credentials.
  • Valid Order Numbers: Shopify order numbers cannot start with "@" character.
  • Feature Enablement: Needs to be explicitly enabled in the Shop Card configuration, or directly in the Shopify order.

Tests

Added comprehensive test coverage in ShpfyOrdersAPITest codeunit:

  1. Configuration Propagation Tests:

    • UnitTestImportOrderPropagatesUseShopifyOrderNo(): Verifies setting propagates when enabled.
    • UnitTestImportOrderPropagatesUseShopifyOrderNoDisabled(): Verifies setting propagates when disabled.
  2. Sales Order Creation Tests:

    • UnitTestCreateSalesOrderWithShopifyOrderNo(): Sales Order uses Shopify number when enabled.
    • UnitTestCreateSalesOrderWithoutShopifyOrderNo(): Sales Order uses BC number series when disabled.
  3. Validation Tests:

    • UnitTestCreateSalesOrderWithShopifyOrderNoInvalidChar(): Error handling for "@" prefix.
  4. Sales Invoice Creation Tests:

    • UnitTestCreateSalesInvoiceWithShopifyOrderNo(): Sales Invoice uses Shopify number for fulfilled orders.
  5. Test Helper Methods:

    • SetManualNosOnOrderNoSeries(): Enables manual numbers on order series.
    • SetManualNosOnInvoiceNoSeries(): Enables manual numbers on invoice series.

Fixes #

Introduces a configurable setting to use the Shopify order number as the document number for Sales Orders and Sales Invoices, with validation to prevent invalid characters. Updates UI, logic, and tests to support the new option and ensure correct propagation and behavior.
Cleans up UI by eliminating unnecessary tooltip descriptions and the explicit default value assignment for the Shopify order number usage option. Simplifies maintenance and reduces duplication, as field intent is already clear from context.
@GediminasGaubys GediminasGaubys requested a review from a team as a code owner February 18, 2026 08:50
@github-actions github-actions bot added AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork labels Feb 18, 2026
@github-actions
Copy link

Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 From Fork Pull request is coming from a fork

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants