[Shopify] Improve Fulfillment Order Line matching using Line Item ID #6157
+91
−123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the reliability of matching Shopify fulfillment order lines to Business Central sales shipment lines by using the
Line Item Iddirectly from Shopify's API, instead of the previous matching logic based on variant, location, and delivery method type.Problem
The previous implementation used a combination of
Shopify Variant Id,Location Id, andDelivery Method Typeto match fulfillment order lines. This approach was fragile and could fail in scenarios with:Solution
lineItem.legacyResourceIdfrom Shopify's FulfillmentOrderLineItem GraphQL response and store it in the new"Line Item Id"field on the"Shpfy FulFillment Order Line"tableLine Item Idinstead of variant-based matchingChanges
Schema Changes:
"Line Item Id"(BigInteger) to"Shpfy FulFillment Order Line"tableKey4on"Shopify Order Id","Line Item Id"for efficient filteringGraphQL Queries:
ShpfyGQLOpenFulfillmOrdLinesandShpfyGQLNextOpenFFOrderLinesto fetchlineItem.id(legacyResourceId)Import Logic:
ShpfyFulfillmentOrdersAPI: Populate"Line Item Id"when importing fulfillment order linesShpfyImportOrder: Filter by"Line Item Id"instead of"Shopify Variant Id"inUpdateLocationIdAndDeliveryMethodOnOrderLineExport Logic:
ShpfyExportShipments: SimplifiedCreateShopifyFulfillmentby removing query-based location/delivery method groupingFindFulfillmentOrderLine->FindFulfillmentOrderLinesto handle multiple fulfillment lines per order line with quantity trackingLocationIdandDeliveryMethodTypeparameters fromCreateFulfillmentOrderRequestCleanup:
ShpfyShipmentLocationquery (no longer needed after refactor)ShpfyObjects.PermissionSet.alTesting
ShpfyShippingHelpertest helper to populate"Line Item Id"ShpfyShippingTestto use the newCreateFulfillmentOrderRequestsignatureFixes AB#617896