From f1932d20c6c7506f462a6e1ecd3dba88ef7f1610 Mon Sep 17 00:00:00 2001 From: v-nesinghal Date: Tue, 14 Jul 2026 04:34:11 +0530 Subject: [PATCH 1/4] Fix and Automation --- .../Sales/Document/SalesHeader.Table.al | 2 +- .../Marketing/TestContactLookup.Codeunit.al | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Layers/W1/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/W1/BaseApp/Sales/Document/SalesHeader.Table.al index cb937f39808..c394c9bc778 100644 --- a/src/Layers/W1/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/W1/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9541,7 +9541,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al b/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al index 1525d42e3c4..58a97881b61 100644 --- a/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al +++ b/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al @@ -561,6 +561,35 @@ codeunit 134837 "Test Contact Lookup" SalesQuote."Sell-to Contact No.".AssertEquals(Contact."No."); end; + [Test] + [HandlerFunctions('ContactListModalPageHandler')] + procedure SellToContactLookupOnSalesQuoteWithCustomerTest() + var + Customer: Record Customer; + SalesHeader: Record "Sales Header"; + SalesQuote: TestPage "Sales Quote"; + begin + // [FEATURE] [Sales Quote] + // [SCENARIO 641671] When "Sell-to Customer No." is set in a Sales Quote then on contact look up the contact list is filtered by the customer's contact "Company No." instead of showing all contacts. + Initialize(); + + // [GIVEN] Create Customer with a Contact. + LibrarySmallBusiness.CreateCustomer(Customer); + Customer.Validate(Contact, StrSubstNo('%1 %2', LibraryUtility.GenerateRandomText(10), LibraryUtility.GenerateRandomText(10))); + + // [GIVEN] Create a Sales Quote for the created customer. + LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader."Document Type"::Quote, Customer."No."); + SalesQuote.OpenEdit(); + SalesQuote.GotoRecord(SalesHeader); + + // [WHEN] Look up contact list from "Sell-to Contact". + LibraryVariableStorage.Enqueue(Customer."Primary Contact No."); + SalesQuote."Sell-to Contact".Lookup(); + + // [THEN] Verify the contact list is filtered by the "Company No." of the customer's contact. + // Verification in ContactListModalPageHandler + end; + local procedure Initialize() var ObjectOptions: Record "Object Options"; From 94a9e44f8af4007f33a5c47516c31cab43a3cb15 Mon Sep 17 00:00:00 2001 From: v-nesinghal Date: Tue, 14 Jul 2026 04:42:06 +0530 Subject: [PATCH 2/4] Miapp --- src/Layers/APAC/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/BE/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/CH/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/CZ/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/ES/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/FI/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/FR/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/GB/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/IT/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/NA/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/NL/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/NO/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- src/Layers/SE/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Layers/APAC/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/APAC/BaseApp/Sales/Document/SalesHeader.Table.al index 06e6272a1a7..b7553978947 100644 --- a/src/Layers/APAC/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/APAC/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9710,7 +9710,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/BE/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/BE/BaseApp/Sales/Document/SalesHeader.Table.al index 53566816419..58b40b2b80a 100644 --- a/src/Layers/BE/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/BE/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9571,7 +9571,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/CH/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/CH/BaseApp/Sales/Document/SalesHeader.Table.al index a80a925abb9..8157538ea28 100644 --- a/src/Layers/CH/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/CH/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9600,7 +9600,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/CZ/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/CZ/BaseApp/Sales/Document/SalesHeader.Table.al index 326436a8fa4..e7d063528ab 100644 --- a/src/Layers/CZ/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/CZ/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9541,7 +9541,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/ES/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/ES/BaseApp/Sales/Document/SalesHeader.Table.al index f8a90897fe1..c0ffaa90a7e 100644 --- a/src/Layers/ES/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/ES/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9667,7 +9667,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/FI/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/FI/BaseApp/Sales/Document/SalesHeader.Table.al index 72e1b35541d..b869ef5ab5a 100644 --- a/src/Layers/FI/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/FI/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9541,7 +9541,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/FR/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/FR/BaseApp/Sales/Document/SalesHeader.Table.al index 67c35c5199a..205b422a472 100644 --- a/src/Layers/FR/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/FR/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9545,7 +9545,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/GB/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/GB/BaseApp/Sales/Document/SalesHeader.Table.al index 326436a8fa4..e7d063528ab 100644 --- a/src/Layers/GB/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/GB/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9541,7 +9541,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/IT/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/IT/BaseApp/Sales/Document/SalesHeader.Table.al index d887a42dfa1..f064e77ee73 100644 --- a/src/Layers/IT/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/IT/BaseApp/Sales/Document/SalesHeader.Table.al @@ -10284,7 +10284,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/NA/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/NA/BaseApp/Sales/Document/SalesHeader.Table.al index d6fa4ba1a64..1e7b5904ead 100644 --- a/src/Layers/NA/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/NA/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9855,7 +9855,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/NL/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/NL/BaseApp/Sales/Document/SalesHeader.Table.al index bca6498c706..56da3ab5c73 100644 --- a/src/Layers/NL/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/NL/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9567,7 +9567,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/NO/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/NO/BaseApp/Sales/Document/SalesHeader.Table.al index ae96fcb30d1..709b7668f58 100644 --- a/src/Layers/NO/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/NO/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9632,7 +9632,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else diff --git a/src/Layers/SE/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/SE/BaseApp/Sales/Document/SalesHeader.Table.al index 0a6aed9c4aa..ab874ecec9c 100644 --- a/src/Layers/SE/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/SE/BaseApp/Sales/Document/SalesHeader.Table.al @@ -9570,7 +9570,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else From 458efada863b5c2cf6f0980e3b75e6346e562534 Mon Sep 17 00:00:00 2001 From: v-nesinghal Date: Tue, 14 Jul 2026 04:42:24 +0530 Subject: [PATCH 3/4] miapp --- src/Layers/RU/BaseApp/Sales/Document/SalesHeader.Table.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Layers/RU/BaseApp/Sales/Document/SalesHeader.Table.al b/src/Layers/RU/BaseApp/Sales/Document/SalesHeader.Table.al index b5f88f8f215..c0f4c737ed0 100644 --- a/src/Layers/RU/BaseApp/Sales/Document/SalesHeader.Table.al +++ b/src/Layers/RU/BaseApp/Sales/Document/SalesHeader.Table.al @@ -10060,7 +10060,7 @@ table 36 "Sales Header" exit(Result); Contact.FilterGroup(2); - if ("Sell-to Customer No." <> '') and ("Document Type" <> "Document Type"::Quote) then + if "Sell-to Customer No." <> '' then if Contact.Get("Sell-to Contact No.") then Contact.SetRange("Company No.", Contact."Company No.") else From c22956aa226539ec9606cf0ad3efe5170eba7b36 Mon Sep 17 00:00:00 2001 From: v-nesinghal Date: Tue, 14 Jul 2026 12:44:42 +0530 Subject: [PATCH 4/4] Suggestion Fix --- src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al b/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al index 58a97881b61..f74c6211099 100644 --- a/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al +++ b/src/Layers/W1/Tests/Marketing/TestContactLookup.Codeunit.al @@ -570,7 +570,7 @@ codeunit 134837 "Test Contact Lookup" SalesQuote: TestPage "Sales Quote"; begin // [FEATURE] [Sales Quote] - // [SCENARIO 641671] When "Sell-to Customer No." is set in a Sales Quote then on contact look up the contact list is filtered by the customer's contact "Company No." instead of showing all contacts. + // [SCENARIO 642199] When "Sell-to Customer No." is set in a Sales Quote then on "Sell-to Contact No." look up the contact list is filtered by the customer's contact "Company No." instead of showing all contacts. Initialize(); // [GIVEN] Create Customer with a Contact. @@ -582,9 +582,9 @@ codeunit 134837 "Test Contact Lookup" SalesQuote.OpenEdit(); SalesQuote.GotoRecord(SalesHeader); - // [WHEN] Look up contact list from "Sell-to Contact". + // [WHEN] Look up contact list from "Sell-to Contact No.". LibraryVariableStorage.Enqueue(Customer."Primary Contact No."); - SalesQuote."Sell-to Contact".Lookup(); + SalesQuote."Sell-to Contact No.".Lookup(); // [THEN] Verify the contact list is filtered by the "Company No." of the customer's contact. // Verification in ContactListModalPageHandler