From 4e7f96c25ccf724354c06f48d58e61ac4a3f8c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miljan=20Milosavljevi=C4=87?= Date: Thu, 21 Nov 2024 13:36:24 +0100 Subject: [PATCH 1/5] Salesperson API --- .../pages/APIV2SalespersonPurchaser.Page.al | 49 +++++++ .../src/APIV2SalespersonPurchE2E.Codeunit.al | 122 ++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al create mode 100644 Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al diff --git a/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al b/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al new file mode 100644 index 0000000000..37ab899966 --- /dev/null +++ b/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al @@ -0,0 +1,49 @@ +namespace Microsoft.API.V2; + +using Microsoft.CRM.Team; + +page 30075 "APIV2 - Salesperson/Purchaser" +{ + DelayedInsert = true; + APIVersion = 'v2.0'; + EntityCaption = 'Salesperson/Purchaser'; + EntitySetCaption = 'Salespeople/Purchasers'; + PageType = API; + ODataKeyFields = SystemId; + EntityName = 'salespersonPurchaser'; + EntitySetName = 'salespeoplePurchasers'; + SourceTable = "Salesperson/Purchaser"; + Extensible = false; + + layout + { + area(Content) + { + repeater(Group) + { + field(id; Rec.SystemId) + { + Caption = 'Id'; + Editable = false; + } + field(code; Rec."Code") + { + Caption = 'Code'; + } + field(displayName; Rec.Name) + { + Caption = 'Name'; + } + field(eMail; Rec."E-Mail") + { + Caption = 'Email'; + } + field(lastModifiedDateTime; Rec.SystemModifiedAt) + { + Caption = 'Last Modified Date'; + Editable = false; + } + } + } + } +} diff --git a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al new file mode 100644 index 0000000000..51444953ac --- /dev/null +++ b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al @@ -0,0 +1,122 @@ +codeunit 139870 "APIV2 - Salesperson/Purch E2E" +{ + Subtype = Test; + + var + Assert: Codeunit Assert; + LibraryGraphMgt: Codeunit "Library - Graph Mgt"; + LibraryUtility: Codeunit "Library - Utility"; + IsInitialized: Boolean; + EmptyJSONErr: Label 'JSON should not be empty.'; + ServiceNameTxt: Label 'salespeoplePurchasers'; + + local procedure Initialize() + begin + if IsInitialized then + exit; + + IsInitialized := true; + Commit(); + end; + + [Test] + procedure GetSalespersonPurchaser() + var + SalespersonPurchaser: Record "Salesperson/Purchaser"; + Response: Text; + TargetURL: Text; + begin + // [SCENARIO] User can get a salesperson/purchaser with a GET request to the service. + Initialize(); + + // [GIVEN] A salesperson/purchaser exists in the system. + CreateSalespersonPurchaser(SalespersonPurchaser); + + // [WHEN] The user makes a GET request for a given salesperson/purchaser. + TargetURL := LibraryGraphMgt.CreateTargetURL(SalespersonPurchaser.SystemId, Page::"APIV2 - Salesperson/Purchaser", ServiceNameTxt); + LibraryGraphMgt.GetFromWebService(Response, TargetURL); + + // [THEN] The response text contains the information about salesperson/purchaser. + VerifyProperties(Response, SalespersonPurchaser); + end; + + [Test] + procedure CreateSalespersonPurchaser() + var + SalespersonPurchaser: Record "Salesperson/Purchaser"; + TempSalespersonPurchaser: Record "Salesperson/Purchaser" temporary; + SalespersonPurchaserJSON: Text; + TargetURL: Text; + Response: Text; + begin + // [SCENARIO] User can create a new salesperson/purchaser through a POST method. + Initialize(); + + // [GIVEN] The user has constructed a salesperson/purchaser JSON object to send to the service. + CreateSalespersonPurchaser(TempSalespersonPurchaser); + SalespersonPurchaserJSON := GetSalespersonPurchaserJSON(TempSalespersonPurchaser); + + // [WHEN] The user posts the JSON to the service. + TargetURL := LibraryGraphMgt.CreateTargetURL('', Page::"APIV2 - Salesperson/Purchaser", ServiceNameTxt); + LibraryGraphMgt.PostToWebService(TargetURL, SalespersonPurchaserJSON, Response); + + // [THEN] The salesperson/purchaser has been created in the database with all the details. + SalespersonPurchaser.Get(TempSalespersonPurchaser.Code); + VerifyProperties(Response, SalespersonPurchaser); + end; + + [Test] + procedure DeleteSalespersonPurchaser() + var + SalespersonPurchaser: Record "Salesperson/Purchaser"; + SalespersonPurchaserCode: Code[10]; + TargetURL: Text; + Response: Text; + begin + // [SCENARIO] User can delete a salesperson/purchaser by making a DELETE request. + Initialize(); + + // [GIVEN] A salesperson/purchaser exists. + CreateSalespersonPurchaser(SalespersonPurchaser); + SalespersonPurchaserCode := SalespersonPurchaser.Code; + + // [WHEN] The user makes a DELETE request to the endpoint for the salesperson/purchaser. + TargetURL := LibraryGraphMgt.CreateTargetURL(SalespersonPurchaser.SystemId, Page::"APIV2 - Salesperson/Purchaser", ServiceNameTxt); + LibraryGraphMgt.DeleteFromWebService(TargetURL, '', Response); + + // [THEN] The response is empty. + Assert.AreEqual('', Response, 'DELETE response should be empty.'); + + // [THEN] The salesperson/purchaser is no longer in the database. + SalespersonPurchaser.SetRange(Code, SalespersonPurchaserCode); + Assert.IsTrue(SalespersonPurchaser.IsEmpty(), 'Salesperson/Purchaser should be deleted.'); + end; + + local procedure CreateSalespersonPurchaser(var SalespersonPurchaser: Record "Salesperson/Purchaser"): Code[20] + begin + SalespersonPurchaser.Init(); + SalespersonPurchaser.Validate( + Code, LibraryUtility.GenerateRandomCode(SalespersonPurchaser.FieldNo(Code), DATABASE::"Salesperson/Purchaser")); + SalespersonPurchaser.Validate(Name, SalespersonPurchaser.Code); // Validating Name as Code because value is not important. + SalespersonPurchaser."E-Mail" := 'a@b.com'; + SalespersonPurchaser.Insert(true); + exit(SalespersonPurchaser.Code); + end; + + local procedure GetSalespersonPurchaserJSON(var SalespersonPurchaser: Record "Salesperson/Purchaser") SalespersonPurchaserJSON: Text + begin + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'code', SalespersonPurchaser.Code); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'displayName', SalespersonPurchaser.Name); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'eMail', SalespersonPurchaser."E-Mail"); + exit(SalespersonPurchaserJSON); + end; + + local procedure VerifyProperties(JSON: Text; SalespersonPurchaser: Record "Salesperson/Purchaser") + begin + Assert.AreNotEqual('', JSON, EmptyJSONErr); + LibraryGraphMgt.VerifyIDInJSON(JSON); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'code', SalespersonPurchaser.Code); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'displayName', SalespersonPurchaser.Name); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'eMail', 'a@b.com'); + end; +} From 922d4998b906e33c9db5a64c5c45e315681bfbed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miljan=20Milosavljevi=C4=87?= Date: Mon, 25 Nov 2024 11:40:30 +0100 Subject: [PATCH 2/5] adressing feedback --- .../pages/APIV2SalespersonPurchaser.Page.al | 30 ++++++++- .../src/APIV2SalespersonPurchE2E.Codeunit.al | 64 +++++++++++++++++-- 2 files changed, 87 insertions(+), 7 deletions(-) diff --git a/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al b/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al index 37ab899966..0774552a7a 100644 --- a/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al +++ b/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al @@ -34,10 +34,38 @@ page 30075 "APIV2 - Salesperson/Purchaser" { Caption = 'Name'; } - field(eMail; Rec."E-Mail") + field(email; Rec."E-Mail") { Caption = 'Email'; } + field(email2; Rec."E-Mail 2") + { + Caption = 'Email 2'; + } + field(phoneNo; Rec."Phone No.") + { + Caption = 'Phone No.'; + } + field(jobTitle; Rec."Job Title") + { + Caption = 'Job Title'; + } + field(commisionPercent; Rec."Commission %") + { + Caption = 'Commission %'; + } + field(privacyBlocked; Rec."Privacy Blocked") + { + Caption = 'Privacy Blocked'; + } + field(blocked; Rec.Blocked) + { + Caption = 'Blocked'; + } + field(coupledToDataverse; Rec."Coupled to Dataverse") + { + Caption = 'Coupled to Dataverse'; + } field(lastModifiedDateTime; Rec.SystemModifiedAt) { Caption = 'Last Modified Date'; diff --git a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al index 51444953ac..26c6227562 100644 --- a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al +++ b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al @@ -6,9 +6,10 @@ codeunit 139870 "APIV2 - Salesperson/Purch E2E" Assert: Codeunit Assert; LibraryGraphMgt: Codeunit "Library - Graph Mgt"; LibraryUtility: Codeunit "Library - Utility"; + LibraryRandom: Codeunit "Library - Random"; IsInitialized: Boolean; - EmptyJSONErr: Label 'JSON should not be empty.'; - ServiceNameTxt: Label 'salespeoplePurchasers'; + EmptyJSONErr: Label 'JSON should not be empty.', Locked = true; + ServiceNameTxt: Label 'salespeoplePurchasers', Locked = true; local procedure Initialize() begin @@ -65,6 +66,36 @@ codeunit 139870 "APIV2 - Salesperson/Purch E2E" VerifyProperties(Response, SalespersonPurchaser); end; + [Test] + procedure ModifySalespersonPurchaserJobTitle() + var + SalespersonPurchaser: Record "Salesperson/Purchaser"; + TempSalespersonPurchaser: Record "Salesperson/Purchaser" temporary; + RequestBody: Text; + Response: Text; + TargetURL: Text; + begin + // [SCENARIO] User can modify a salesperson/purchaser through a PATCH request. + Initialize(); + + // [GIVEN] A salesperson/purchaser exists. + CreateSalespersonPurchaser(SalespersonPurchaser); + TempSalespersonPurchaser.TransferFields(SalespersonPurchaser); + TempSalespersonPurchaser."Job Title" := LibraryUtility.GenerateGUID(); + RequestBody := GetSalespersonPurchaserJSON(TempSalespersonPurchaser); + + // [WHEN] The user makes a patch request to the service and specifies Job Title field. + TargetURL := LibraryGraphMgt.CreateTargetURL(SalespersonPurchaser.SystemId, Page::"APIV2 - Salesperson/Purchaser", ServiceNameTxt); + LibraryGraphMgt.PatchToWebService(TargetURL, RequestBody, Response); + + // [THEN] The response contains the new values. + VerifyProperties(Response, TempSalespersonPurchaser); + + // [THEN] The salesperson/purchaser in the database contains the updated values. + SalespersonPurchaser.Get(SalespersonPurchaser.Code); + Assert.AreEqual(SalespersonPurchaser."Job Title", TempSalespersonPurchaser."Job Title", 'Job Title should be equal.'); + end; + [Test] procedure DeleteSalespersonPurchaser() var @@ -97,8 +128,15 @@ codeunit 139870 "APIV2 - Salesperson/Purch E2E" SalespersonPurchaser.Init(); SalespersonPurchaser.Validate( Code, LibraryUtility.GenerateRandomCode(SalespersonPurchaser.FieldNo(Code), DATABASE::"Salesperson/Purchaser")); - SalespersonPurchaser.Validate(Name, SalespersonPurchaser.Code); // Validating Name as Code because value is not important. - SalespersonPurchaser."E-Mail" := 'a@b.com'; + SalespersonPurchaser.Name := LibraryUtility.GenerateRandomText(50); + SalespersonPurchaser."E-Mail" := LibraryUtility.GenerateRandomEmail(); + SalespersonPurchaser."E-Mail 2" := LibraryUtility.GenerateRandomEmail(); + SalespersonPurchaser."Phone No." := LibraryUtility.GenerateRandomPhoneNo(); + SalespersonPurchaser."Job Title" := LibraryUtility.GenerateRandomText(30); + SalespersonPurchaser."Commission %" := LibraryRandom.RandInt(100); + SalespersonPurchaser."Privacy Blocked" := true; + SalespersonPurchaser.Blocked := true; + SalespersonPurchaser."Coupled to Dataverse" := true; SalespersonPurchaser.Insert(true); exit(SalespersonPurchaser.Code); end; @@ -107,7 +145,14 @@ codeunit 139870 "APIV2 - Salesperson/Purch E2E" begin SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'code', SalespersonPurchaser.Code); SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'displayName', SalespersonPurchaser.Name); - SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'eMail', SalespersonPurchaser."E-Mail"); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'email', SalespersonPurchaser."E-Mail"); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'email2', SalespersonPurchaser."E-Mail 2"); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'phoneNo', SalespersonPurchaser."Phone No."); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'jobTitle', SalespersonPurchaser."Job Title"); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'commisionPercent', SalespersonPurchaser."Commission %"); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'privacyBlocked', SalespersonPurchaser."Privacy Blocked"); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'blocked', SalespersonPurchaser.Blocked); + SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'coupledToDataverse', SalespersonPurchaser."Coupled to Dataverse"); exit(SalespersonPurchaserJSON); end; @@ -117,6 +162,13 @@ codeunit 139870 "APIV2 - Salesperson/Purch E2E" LibraryGraphMgt.VerifyIDInJSON(JSON); LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'code', SalespersonPurchaser.Code); LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'displayName', SalespersonPurchaser.Name); - LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'eMail', 'a@b.com'); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'email', SalespersonPurchaser."E-Mail"); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'email2', SalespersonPurchaser."E-Mail 2"); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'phoneNo', SalespersonPurchaser."Phone No."); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'jobTitle', SalespersonPurchaser."Job Title"); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'commisionPercent', Format(SalespersonPurchaser."Commission %", 0, 9)); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'privacyBlocked', Format(SalespersonPurchaser."Privacy Blocked", 0, 9)); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'blocked', Format(SalespersonPurchaser.Blocked, 0, 9)); + LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'coupledToDataverse', Format(SalespersonPurchaser."Coupled to Dataverse", 0, 9)); end; } From 4abaa7586dcf98e5a8c0747fb89b255ecee3574a Mon Sep 17 00:00:00 2001 From: Jesper Schulz-Wedde Date: Wed, 27 Nov 2024 15:35:58 +0100 Subject: [PATCH 3/5] Update clashing ID --- Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al index 26c6227562..abc4a7e7a2 100644 --- a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al +++ b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al @@ -1,4 +1,4 @@ -codeunit 139870 "APIV2 - Salesperson/Purch E2E" +codeunit 139882 "APIV2 - Salesperson/Purch E2E" { Subtype = Test; From 99ccfa2c7638b23fa41d15545af8fe77daca0629 Mon Sep 17 00:00:00 2001 From: Jesper Schulz-Wedde Date: Thu, 28 Nov 2024 15:51:22 +0100 Subject: [PATCH 4/5] Apply suggestions from internal code review Should make the PR pass CI. --- .../APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al | 4 ---- Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al b/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al index 0774552a7a..77bd6f55d2 100644 --- a/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al +++ b/Apps/W1/APIV2/app/src/pages/APIV2SalespersonPurchaser.Page.al @@ -62,10 +62,6 @@ page 30075 "APIV2 - Salesperson/Purchaser" { Caption = 'Blocked'; } - field(coupledToDataverse; Rec."Coupled to Dataverse") - { - Caption = 'Coupled to Dataverse'; - } field(lastModifiedDateTime; Rec.SystemModifiedAt) { Caption = 'Last Modified Date'; diff --git a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al index abc4a7e7a2..2b5cc62d43 100644 --- a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al +++ b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al @@ -133,7 +133,7 @@ codeunit 139882 "APIV2 - Salesperson/Purch E2E" SalespersonPurchaser."E-Mail 2" := LibraryUtility.GenerateRandomEmail(); SalespersonPurchaser."Phone No." := LibraryUtility.GenerateRandomPhoneNo(); SalespersonPurchaser."Job Title" := LibraryUtility.GenerateRandomText(30); - SalespersonPurchaser."Commission %" := LibraryRandom.RandInt(100); + SalespersonPurchaser."Commission %" := LibraryRandom.RandDec(100, 2); SalespersonPurchaser."Privacy Blocked" := true; SalespersonPurchaser.Blocked := true; SalespersonPurchaser."Coupled to Dataverse" := true; @@ -152,7 +152,6 @@ codeunit 139882 "APIV2 - Salesperson/Purch E2E" SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'commisionPercent', SalespersonPurchaser."Commission %"); SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'privacyBlocked', SalespersonPurchaser."Privacy Blocked"); SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'blocked', SalespersonPurchaser.Blocked); - SalespersonPurchaserJSON := LibraryGraphMgt.AddPropertytoJSON(SalespersonPurchaserJSON, 'coupledToDataverse', SalespersonPurchaser."Coupled to Dataverse"); exit(SalespersonPurchaserJSON); end; @@ -167,8 +166,5 @@ codeunit 139882 "APIV2 - Salesperson/Purch E2E" LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'phoneNo', SalespersonPurchaser."Phone No."); LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'jobTitle', SalespersonPurchaser."Job Title"); LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'commisionPercent', Format(SalespersonPurchaser."Commission %", 0, 9)); - LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'privacyBlocked', Format(SalespersonPurchaser."Privacy Blocked", 0, 9)); - LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'blocked', Format(SalespersonPurchaser.Blocked, 0, 9)); - LibraryGraphMgt.VerifyPropertyInJSON(JSON, 'coupledToDataverse', Format(SalespersonPurchaser."Coupled to Dataverse", 0, 9)); end; } From ce4961f5b30448331d30e7ae2c467cb3f57a1ac4 Mon Sep 17 00:00:00 2001 From: Jesper Schulz-Wedde Date: Fri, 29 Nov 2024 09:06:38 +0100 Subject: [PATCH 5/5] Align tests with internal version of them --- Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al | 1 + 1 file changed, 1 insertion(+) diff --git a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al index 2b5cc62d43..2c2c86a25f 100644 --- a/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al +++ b/Apps/W1/APIV2/test/src/APIV2SalespersonPurchE2E.Codeunit.al @@ -138,6 +138,7 @@ codeunit 139882 "APIV2 - Salesperson/Purch E2E" SalespersonPurchaser.Blocked := true; SalespersonPurchaser."Coupled to Dataverse" := true; SalespersonPurchaser.Insert(true); + Commit(); exit(SalespersonPurchaser.Code); end;