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

Expected behavior
- When a Custom Item named "Tip" is added, only that specific line should be marked as a Tip.
- Any items added after the Tip line should be treated according to their own item type and not inherit the Tip classification.
- 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
- Go to Shopify.
- Create a new order.
- Add a Custom Item with the name "Tip".
- Add another item (either:
A standard item, or
Another custom item with a different name).
- Complete/Fulfil the order to make sync in BC.
- Sync the Order to Business Central.
- Open the Shopify order in Business Central.
- 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
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
Expected behavior
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
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