Skip to content

[Contribution Process Bug]: Getting Last Record values in the Next "Shopify Order Line" #6811

@github-vlc

Description

@github-vlc

Describe the issue

When placing an order from Shopify into Business Central, if a Custom Item named "Tip" is added, it is correctly recognized and marked as a Tip line.

However, after adding a Tip line, any subsequent item (standard item or custom item) in the same order is also incorrectly marked as a Tip.

The issue occurs because a variable related to the Tip classification is not properly initialized/reset during the iteration of order lines in codeunit 30161 "Shpfy Import Order", specifically in the SetAndInsertOrderLines procedure. As a result, the Tip flag/state persists across iterations and affects subsequent order lines.

This leads to incorrect order line classification in Business Central as shown below

Image

Expected behavior

  1. When a Custom Item named "Tip" is added, only that specific line should be marked as a Tip.
  2. Any items added after the Tip line should be treated according to their own item type and not inherit the Tip classification.
  3. Each order line should be processed independently without retaining state from previously processed lines.

local procedure SetAndInsertOrderLines(OrderId: BigInteger; JOrderLines: JsonArray; var TempOrderLine: Record "Shpfy Order Line" temporary; var DataCaptureDict: Dictionary of [BigInteger, JsonToken]) var JOrderLine: JsonToken; begin foreach JOrderLine in JOrderLines do begin // by cleaning the variable may be we can get the expected result as below commented line // Clear(TempOrderLine); // TempOrderLine.Init(); if SetOrderLineValuesFromJson(JOrderLine, OrderId, TempOrderLine) then begin TempOrderLine.Insert(); DataCaptureDict.Add(TempOrderLine."Line Id", JOrderLine); end; end; end;

Steps to reproduce

  1. Go to Shopify.
  2. Create a new order.
  3. Add a Custom Item with the name "Tip".
  4. Add another item (either:

    A standard item, or
    Another custom item with a different name).

  5. Complete/Fulfil the order to make sync in BC.
  6. Sync the Order to Business Central.
  7. Open the Shopify order in Business Central.
  8. Review the order lines.

Actual Result:
All order lines added after the "Tip" item are marked as Tip.

Expected Result:
Only the line explicitly named "Tip" should be marked as Tip. Subsequent lines should retain their correct item type.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Contribution-BugSomething isn't working in the contribution process

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions