From 391fd3d805e0cabafce91f682073443016a9f87c Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Tue, 19 May 2026 19:35:38 +0200 Subject: [PATCH] [Shopify] Persist current B2B Catalog row before disabling Sync Prices on other lines When the user enables `Sync Prices` on a B2B Catalog row whose catalog ID is already in use on another company row and clicks `Yes` on the confirmation dialog, the current row's toggle was being lost. The OnValidate trigger called `OtherCatalog.ModifyAll("Sync Prices", false)` against the same table before the page had a chance to persist the user's change on the current row. The resulting client refresh re-read the current row from the database (still `Sync Prices = false`), clobbering the in-memory `true`. Persist the current Rec with `Modify()` before the `ModifyAll` on the other rows so the database already reflects the user's intent if the page refreshes. Also strengthen `SyncPricesConfirmDisablesOtherLine` to re-read Catalog2 from the database (mirroring the existing pattern used for Catalog1) so the test would catch this regression. Fixes AB#630273 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../W1/Shopify/App/src/Catalogs/Tables/ShpfyCatalog.Table.al | 2 ++ .../Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Apps/W1/Shopify/App/src/Catalogs/Tables/ShpfyCatalog.Table.al b/src/Apps/W1/Shopify/App/src/Catalogs/Tables/ShpfyCatalog.Table.al index c3870f482a..c89754a7dc 100644 --- a/src/Apps/W1/Shopify/App/src/Catalogs/Tables/ShpfyCatalog.Table.al +++ b/src/Apps/W1/Shopify/App/src/Catalogs/Tables/ShpfyCatalog.Table.al @@ -199,6 +199,8 @@ table 30152 "Shpfy Catalog" exit; end; + Modify(); + OtherCatalog.ModifyAll("Sync Prices", false); end; diff --git a/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al index e78f9db18e..bbad17f781 100644 --- a/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al @@ -524,7 +524,8 @@ codeunit 139646 "Shpfy Catalog Prices Test" Catalog2.Validate("Sync Prices", true); Catalog2.Modify(true); - // [THEN] Catalog2 has Sync Prices = true + // [THEN] Catalog2 persists Sync Prices = true in the database + Catalog2.Get(CatalogId, ShopifyCompany2.SystemId); LibraryAssert.IsTrue(Catalog2."Sync Prices", 'Catalog2 should have Sync Prices enabled'); // [THEN] Catalog1 has Sync Prices = false (disabled by the confirmation logic)