Skip to content

Commit 8300a9e

Browse files
onbuyukaclaude
andauthored
[Shopify] Fix Shopify refund/return deletion wiping all lines (#7320)
## Summary - **Bug 626081**: Deleting a single Shopify refund or return header deletes lines for **all** refunds/returns, not just the deleted one - **Root cause**: `SetRange("Field Name")` in `OnDelete` triggers was called without a value parameter, which clears the filter instead of setting it — causing `DeleteAll` to wipe the entire line table - **Fix**: Pass `Rec."Refund Id"` / `Rec."Return Id"` as the second parameter to `SetRange` in 3 locations across 2 files Fixes [AB#626081](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/626081) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 44301e1 commit 8300a9e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Apps/W1/Shopify/App/src/Order Refunds/Tables/ShpfyRefundHeader.Table.al

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ table 30142 "Shpfy Refund Header"
166166
RefundShippingLine: Record "Shpfy Refund Shipping Line";
167167
DataCapture: Record "Shpfy Data Capture";
168168
begin
169-
RefundLine.SetRange("Refund Id");
169+
RefundLine.SetRange("Refund Id", Rec."Refund Id");
170170
if not RefundLine.IsEmpty() then
171171
RefundLine.DeleteAll(true);
172172

173-
RefundShippingLine.SetRange("Refund Id");
173+
RefundShippingLine.SetRange("Refund Id", Rec."Refund Id");
174174
if not RefundShippingLine.IsEmpty() then
175175
RefundShippingLine.DeleteAll(true);
176176

src/Apps/W1/Shopify/App/src/Order Returns/Tables/ShpfyReturnHeader.Table.al

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ table 30147 "Shpfy Return Header"
130130
ReturnLine: Record "Shpfy Return Line";
131131
DataCapture: Record "Shpfy Data Capture";
132132
begin
133-
ReturnLine.SetRange("Return Id");
133+
ReturnLine.SetRange("Return Id", Rec."Return Id");
134134
if not ReturnLine.IsEmpty() then
135135
ReturnLine.DeleteAll(true);
136136

0 commit comments

Comments
 (0)