Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8552212
[Bug] Disable customer asset conversion for CRM products during synch…
tomasevicst Sep 5, 2026
84a9998
[Bug] Remove obsolete Convert to Customer Asset flag and update synch…
tomasevicst Sep 5, 2026
482d353
[Bug] Update obsolete service item synchronization logic and enhance …
tomasevicst Sep 6, 2026
a5191e7
[Bug] Remove obsolete IgnoreServiceItemsByConvertToCustomerAssetFlag …
tomasevicst Sep 6, 2026
e3d1c2a
[Bug] Refactor IgnoreServiceItemsByConvertToCustomerAssetFlag procedu…
tomasevicst Sep 7, 2026
1323d7b
Merge remote-tracking branch 'origin/main' into bugs/649195_FS_Duplic…
tomasevicst Sep 7, 2026
2378ecc
[Bug] Update IgnoreServiceItemsByConvertToCustomerAssetFlag procedure…
tomasevicst Sep 7, 2026
225f4dd
[Bug] Update IgnoreServiceItemsByConvertToCustomerAssetFlag procedure…
tomasevicst Sep 7, 2026
1d615d8
[Bug] Enhance customer asset conversion logic and add tests for modif…
tomasevicst Sep 8, 2026
be17c20
[Bug] Remove obsolete conditional compilation for service item synchr…
tomasevicst Sep 8, 2026
dcf5600
[Bug] Enhance DisableCustomerAssetConversion procedure to handle exis…
tomasevicst Sep 8, 2026
326579a
[Bug] Update OnAfterTransferRecordFields procedure to include Destina…
tomasevicst Sep 9, 2026
f0b6ce4
[Bug] Fix logic in customer asset conversion to correctly check Desti…
tomasevicst Sep 9, 2026
bb07946
[Bug] Add handling for existing CRM products in customer asset conver…
tomasevicst Sep 9, 2026
7acb788
[Bug] Refactor customer asset conversion logic to correctly handle ex…
tomasevicst Sep 9, 2026
b6614f9
[Bug] Simplify CRM product handling in customer asset conversion logi…
tomasevicst Sep 10, 2026
ab1b3a7
[Bug] Update OnAfterTransferRecordFields event subscriber to disable …
tomasevicst Sep 10, 2026
2b915d6
Merge remote-tracking branch 'origin/main' into bugs/649195_FS_Duplic…
tomasevicst Sep 11, 2026
890d0ee
Enhance FS Int. Table Subscriber event subscription and update integr…
tomasevicst Sep 11, 2026
266c0b8
Merge branch 'main' into bugs/649195_FS_Duplicate_Field_Service_Custo…
tomasevicst Sep 17, 2026
bc0d664
Add handling for existing CRM products in customer asset conversion
tomasevicst Sep 17, 2026
1d1420e
Refactor customer asset conversion logic to utilize item management s…
tomasevicst Sep 18, 2026
e894abd
Refactor customer asset conversion procedures by removing redundant C…
tomasevicst Sep 18, 2026
3e4e3c2
Merge branch 'main' into bugs/649195_FS_Duplicate_Field_Service_Custo…
tomasevicst Sep 18, 2026
4d32491
Remove obsolete documentation and workspace files for Sales Order Agent
tomasevicst Sep 18, 2026
b53f402
Remove unused using directive for D365Sales in FS Integration Test Li…
tomasevicst Sep 19, 2026
422aa14
Merge branch 'main' into bugs/649195_FS_Duplicate_Field_Service_Custo…
tomasevicst Sep 19, 2026
c5796a5
Merge branch 'main' of github.com:microsoft/BCApps into bugs/649195_F…
tomasevicst Sep 21, 2026
e8302a6
Implement handling for field modification checks in FS Int. Table Sub…
tomasevicst Sep 21, 2026
182701a
Refactor FS Int. Table Subscriber to use ItemIsManaged for customer a…
tomasevicst Sep 22, 2026
7ecda20
Add ExistingCRMProduct record handling for customer asset conversion …
tomasevicst Sep 22, 2026
f32e455
Merge remote-tracking branch 'origin/main' into bugs/649195_FS_Duplic…
tomasevicst Sep 25, 2026
e3ec809
Refactor FS Int. Table Subscriber and related tests to streamline cus…
tomasevicst Sep 25, 2026
b06ffe4
Implement logic to disable customer asset conversion during initial i…
tomasevicst Sep 25, 2026
2ec90f9
Disable customer asset conversion during item synchronization and upd…
tomasevicst Sep 25, 2026
05155ed
Fix Field Service item synchronization test setup
tomasevicst Sep 26, 2026
901cfcf
Refactor customer asset conversion logic in FS Int. Table Subscriber …
tomasevicst Sep 26, 2026
f888bf4
Couple item UOMs in Field Service sync tests
tomasevicst Sep 26, 2026
763ed09
Initialize CRM base currency in item sync tests
tomasevicst Sep 27, 2026
cae07cc
Update CRM connection setup logic in item synchronization test
tomasevicst Sep 27, 2026
a0fb3df
Initialize CDS base currency in item sync tests
tomasevicst Sep 27, 2026
f0f9878
Create CRM unit groups in item sync tests
tomasevicst Sep 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,14 @@ codeunit 6610 "FS Int. Table Subscriber"
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Integration Rec. Synch. Invoke", 'OnAfterTransferRecordFields', '', true, false)]
local procedure OnAfterTransferRecordFields(SourceRecordRef: RecordRef; var DestinationRecordRef: RecordRef; var AdditionalFieldsWereModified: Boolean)
local procedure OnAfterTransferRecordFields(SourceRecordRef: RecordRef; var DestinationRecordRef: RecordRef; var AdditionalFieldsWereModified: Boolean; DestinationIsInserted: Boolean)
var
FSConnectionSetup: Record "FS Connection Setup";
FSWorkOrderProduct: Record "FS Work Order Product";
FSWorkOrderService: Record "FS Work Order Service";
FSBookableResourceBooking: Record "FS Bookable Resource Booking";
CRMProduct: Record "CRM Product";
ExistingCRMProduct: Record "CRM Product";
ServiceLine: Record "Service Line";
SourceDestCode: Text;
begin
Expand All @@ -299,6 +301,17 @@ codeunit 6610 "FS Int. Table Subscriber"
SourceDestCode := GetSourceDestCode(SourceRecordRef, DestinationRecordRef);

case SourceDestCode of
'Item-CRM Product':
begin
if not DestinationIsInserted then
exit;

DestinationRecordRef.SetTable(CRMProduct);
ExistingCRMProduct.SetLoadFields(ConvertToCustomerAsset);
ExistingCRMProduct.Get(CRMProduct.ProductId);
if ExistingCRMProduct.ConvertToCustomerAsset then
AdditionalFieldsWereModified := true;
end;
'FS Work Order Product-Service Line':
begin
SourceRecordRef.SetTable(FSWorkOrderProduct);
Expand Down Expand Up @@ -1383,6 +1396,8 @@ codeunit 6610 "FS Int. Table Subscriber"
SourceDestCode := GetSourceDestCode(SourceRecordRef, DestinationRecordRef);

case SourceDestCode of
'Item-CRM Product':
DisableCustomerAssetConversion(DestinationRecordRef);
'FS Work Order Service-Job Journal Line':
UpdateCorrelatedJobJournalLine(SourceRecordRef, DestinationRecordRef);
'Service Header-FS Work Order':
Expand Down Expand Up @@ -1444,7 +1459,7 @@ codeunit 6610 "FS Int. Table Subscriber"
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"CRM Setup Defaults", 'OnResetItemProductMappingOnAfterInsertFieldsMapping', '', false, false)]
local procedure AddFieldServiceProductTypeFieldMapping(var Sender: Codeunit "CRM Setup Defaults"; IntegrationTableMappingName: Code[20])
local procedure AddFieldServiceProductMappings(var Sender: Codeunit "CRM Setup Defaults"; IntegrationTableMappingName: Code[20])
var
FSConnectionSetup: Record "FS Connection Setup";
Item: Record Item;
Expand All @@ -1461,6 +1476,14 @@ codeunit 6610 "FS Int. Table Subscriber"
CRMProduct.FieldNo(FieldServiceProductType),
IntegrationFieldMapping.Direction::ToIntegrationTable,
'', false, false);

// Business Central service items are the source for Field Service customer assets.
Sender.InsertIntegrationFieldMapping(
IntegrationTableMappingName,
0,
CRMProduct.FieldNo(ConvertToCustomerAsset),
IntegrationFieldMapping.Direction::ToIntegrationTable,
'false', false, false);
end;

local procedure UpdateCorrelatedJobJournalLine(var SourceRecordRef: RecordRef; var DestinationRecordRef: RecordRef)
Expand Down Expand Up @@ -1627,7 +1650,7 @@ codeunit 6610 "FS Int. Table Subscriber"
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Integration Rec. Synch. Invoke", 'OnBeforeInsertRecord', '', true, false)]
local procedure HandleOnBeforeInsertRecord(SourceRecordRef: RecordRef; DestinationRecordRef: RecordRef)
local procedure HandleOnBeforeInsertRecord(SourceRecordRef: RecordRef; var DestinationRecordRef: RecordRef)
var
FSProjectTask: Record "FS Project Task";
Customer: Record Customer;
Expand Down Expand Up @@ -1662,6 +1685,8 @@ codeunit 6610 "FS Int. Table Subscriber"
SourceDestCode := GetSourceDestCode(SourceRecordRef, DestinationRecordRef);

case SourceDestCode of
'Item-CRM Product':
DisableCustomerAssetConversion(DestinationRecordRef);
'Location-FS Warehouse':
SetCompanyId(DestinationRecordRef);
'Service Item-FS Customer Asset':
Expand Down Expand Up @@ -2518,8 +2543,6 @@ codeunit 6610 "FS Int. Table Subscriber"
IgnoreArchievedServiceOrdersOnQueryPostFilterIgnoreRecord(SourceRecordRef, IgnoreRecord);
Database::"FS Work Order":
IgnoreArchievedCRMWorkOrdersOnQueryPostFilterIgnoreRecord(SourceRecordRef, IgnoreRecord);
Database::"Service Item":
IgnoreServiceItemsByConvertToCustomerAssetFlag(SourceRecordRef, IgnoreRecord);
end;

if FSConnectionSetup.IsEnabled() then
Expand Down Expand Up @@ -2685,6 +2708,8 @@ codeunit 6610 "FS Int. Table Subscriber"
IgnoreRecord := true;
end;

#pragma warning disable AS0105
[Obsolete('Remove calls to this procedure. Service items are always synchronized to Field Service customer assets; item-product synchronization disables customer asset conversion.', '30.0')]
internal procedure IgnoreServiceItemsByConvertToCustomerAssetFlag(SourceRecordRef: RecordRef; var IgnoreRecord: Boolean)
var
FSConnectionSetup: Record "FS Connection Setup";
Expand Down Expand Up @@ -2718,6 +2743,7 @@ codeunit 6610 "FS Int. Table Subscriber"
if not CRMProduct.ConvertToCustomerAsset then
IgnoreRecord := true;
end;
#pragma warning restore AS0105

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Integration Table Synch.", 'OnAfterInitSynchJob', '', true, true)]
local procedure LogTelemetryOnAfterInitSynchJob(ConnectionType: TableConnectionType; IntegrationTableID: Integer)
Expand Down Expand Up @@ -2780,6 +2806,15 @@ codeunit 6610 "FS Int. Table Subscriber"
exit('');
end;

local procedure DisableCustomerAssetConversion(var DestinationRecordRef: RecordRef)
var
CRMProduct: Record "CRM Product";
begin
DestinationRecordRef.SetTable(CRMProduct);
CRMProduct.ConvertToCustomerAsset := false;
DestinationRecordRef.GetTable(CRMProduct);
end;

[EventSubscriber(ObjectType::Table, Database::"Service Mgt. Setup", 'OnBeforeValidateEvent', 'One Service Item Line/Order', true, false)]
local procedure ServiceMgtSetupOnBeforeValidateOneServiceItemLinePerOrder(var Rec: Record "Service Mgt. Setup")
var
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,17 @@ codeunit 139205 "FS Integration Test Library"
FSIntTableSubscriber.IgnoreArchievedCRMWorkOrdersOnQueryPostFilterIgnoreRecord(SourceRecordRef, IgnoreRecord);
end;

/// <summary>
/// Retained for compatibility. Service items are now always synchronized to Field Service customer assets, so this procedure leaves the synchronization decision unchanged.
Comment thread
tomasevicst marked this conversation as resolved.
/// </summary>
/// <param name="SourceRecordRef">A reference to the service item to evaluate.</param>
/// <param name="IgnoreRecord">The existing synchronization decision, which is left unchanged.</param>
#pragma warning disable AS0105
[Obsolete('Remove calls to this procedure. Service items are always synchronized to Field Service customer assets; item-product synchronization disables customer asset conversion.', '30.0')]
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
Comment thread
tomasevicst marked this conversation as resolved.
procedure IgnoreServiceItemsByConvertToCustomerAssetFlag(SourceRecordRef: RecordRef; var IgnoreRecord: Boolean)
var
FSIntTableSubscriber: Codeunit "FS Int. Table Subscriber";
begin
FSIntTableSubscriber.IgnoreServiceItemsByConvertToCustomerAssetFlag(SourceRecordRef, IgnoreRecord);
end;
#pragma warning restore AS0105

procedure MarkArchivedServiceOrder(ServiceHeader: Record "Service Header")
var
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ using Microsoft.Purchases.Vendor;
using Microsoft.Sales.Customer;
using Microsoft.Service.Archive;
using Microsoft.Service.Document;
using Microsoft.Service.Item;
using Microsoft.Service.Setup;
using Microsoft.Service.Test;
using Microsoft.TestLibraries.DynamicsFieldService;
Expand Down Expand Up @@ -1578,109 +1577,103 @@ codeunit 139204 "FS Integration Test"
end;

[Test]
procedure IgnoreServiceItemWhenConvertToCustomerAssetIsFalse()
[TransactionModel(TransactionModel::AutoCommit)]
procedure InitialItemSynchronizationDisablesCustomerAssetConversion()
var
Item: Record Item;
TempServiceItem: Record "Service Item" temporary;
CRMProduct: Record "CRM Product";
CRMIntegrationRecord: Record "CRM Integration Record";
RecordRef: RecordRef;
IgnoreRecord: Boolean;
ProductId: Guid;
CRMProduct: Record "CRM Product";
CRMTransactioncurrency: Record "CRM Transactioncurrency";
CRMUom: Record "CRM Uom";
Currency: Record Currency;
IntegrationTableMapping: Record "Integration Table Mapping";
Item: Record Item;
CRMIntegrationTableSynch: Codeunit "CRM Integration Table Synch.";
CRMSetupDefaults: Codeunit "CRM Setup Defaults";
JobID: Guid;
begin
// [FEATURE] [Service Item Mapping]
// [SCENARIO] Service Item is skipped when linked CRM Product has Convert to Customer Asset = No.
// [FEATURE] [Item-Product Mapping]
// [SCENARIO] The first synchronization of an item disables native Field Service customer asset creation.
Initialize();
InitSetup(true, '');

Item.Get(CreateItem());
TempServiceItem."Item No." := Item."No.";
RecordRef.GetTable(TempServiceItem);
InitializeItemProductSynchronization();

ProductId := CreateGuid();
CRMProduct.ProductId := ProductId;
CRMProduct.ConvertToCustomerAsset := false;
CRMProduct.Insert(false);
// [GIVEN] An uncoupled item whose unit of measure and currency are coupled to Dataverse.
CRMSetupDefaults.ResetItemProductMapping('ITEM-PRODUCT', false);
CreateItemWithCoupledUnitOfMeasure(Item, CRMUom);
LibraryCRMIntegration.CreateCoupledCurrencyAndTransactionCurrency(Currency, CRMTransactioncurrency);
IntegrationTableMapping.Get('ITEM-PRODUCT');

CRMIntegrationRecord.CoupleCRMIDToRecordID(ProductId, Item.RecordId());
// [WHEN] The item is synchronized to a new Field Service product.
JobID := CRMIntegrationTableSynch.SynchRecord(IntegrationTableMapping, Item.RecordId(), true, true);

FSIntegrationTestLibrary.IgnoreServiceItemsByConvertToCustomerAssetFlag(RecordRef, IgnoreRecord);

Assert.IsTrue(IgnoreRecord, 'Service Item should be ignored when Convert to Customer Asset is false.');
// [THEN] Native Field Service customer asset creation is disabled on the new product.
VerifySuccessfulIntegrationSynchJob(JobID, 1, 0);
Assert.IsTrue(CRMIntegrationRecord.FindByRecordID(Item.RecordId()), 'The item should be coupled to a product.');
CRMProduct.Get(CRMIntegrationRecord."CRM ID");
Assert.IsFalse(CRMProduct.ConvertToCustomerAsset, 'Convert to Customer Asset should be disabled.');
end;

[Test]
procedure DoNotIgnoreServiceItemWhenConvertToCustomerAssetIsTrue()
[TransactionModel(TransactionModel::AutoCommit)]
procedure ItemSynchronizationDisablesCustomerAssetConversion()
Comment thread
tomasevicst marked this conversation as resolved.
var
Comment thread
tomasevicst marked this conversation as resolved.
Item: Record Item;
TempServiceItem: Record "Service Item" temporary;
CRMProduct: Record "CRM Product";
CRMIntegrationRecord: Record "CRM Integration Record";
RecordRef: RecordRef;
IgnoreRecord: Boolean;
ProductId: Guid;
CRMUom: Record "CRM Uom";
IntegrationFieldMapping: Record "Integration Field Mapping";
IntegrationTableMapping: Record "Integration Table Mapping";
CRMIntegrationTableSynch: Codeunit "CRM Integration Table Synch.";
CRMSetupDefaults: Codeunit "CRM Setup Defaults";
JobID: Guid;
begin
// [FEATURE] [Service Item Mapping]
// [SCENARIO] Service Item is not skipped when linked CRM Product has Convert to Customer Asset = Yes.
// [FEATURE] [Item-Product Mapping]
// [SCENARIO] Synchronizing an item disables native Field Service customer asset creation.
Initialize();
InitSetup(true, '');

Item.Get(CreateItem());
TempServiceItem."Item No." := Item."No.";
RecordRef.GetTable(TempServiceItem);
InitializeItemProductSynchronization();

ProductId := CreateGuid();
CRMProduct.ProductId := ProductId;
// [GIVEN] A coupled item and product where Convert to Customer Asset is Yes and the existing mapping has no conversion rule.
CRMSetupDefaults.ResetItemProductMapping('ITEM-PRODUCT', false);
Comment thread
tomasevicst marked this conversation as resolved.
CreateItemWithCoupledUnitOfMeasure(Item, CRMUom);
LibraryCRMIntegration.CoupleItem(Item, CRMUom, CRMProduct);
CRMProduct.ConvertToCustomerAsset := true;
CRMProduct.Insert(false);

CRMIntegrationRecord.CoupleCRMIDToRecordID(ProductId, Item.RecordId());

FSIntegrationTestLibrary.IgnoreServiceItemsByConvertToCustomerAssetFlag(RecordRef, IgnoreRecord);

Assert.IsFalse(IgnoreRecord, 'Service Item should not be ignored when Convert to Customer Asset is true.');
end;

[Test]
procedure DoNotIgnoreServiceItemWhenItemNoIsBlank()
var
TempServiceItem: Record "Service Item" temporary;
RecordRef: RecordRef;
IgnoreRecord: Boolean;
begin
// [FEATURE] [Service Item Mapping]
// [SCENARIO] Service Item with blank Item No. is not skipped by this filter.
Initialize();
InitSetup(true, '');
CRMProduct.Modify();

TempServiceItem."Item No." := '';
RecordRef.GetTable(TempServiceItem);
IntegrationFieldMapping.SetRange("Integration Table Mapping Name", 'ITEM-PRODUCT');
IntegrationFieldMapping.SetRange("Integration Table Field No.", CRMProduct.FieldNo(ConvertToCustomerAsset));
IntegrationFieldMapping.DeleteAll();
IntegrationTableMapping.Get('ITEM-PRODUCT');

FSIntegrationTestLibrary.IgnoreServiceItemsByConvertToCustomerAssetFlag(RecordRef, IgnoreRecord);
// [WHEN] The item is synchronized to the Field Service product.
JobID := CRMIntegrationTableSynch.SynchRecord(IntegrationTableMapping, Item.RecordId(), true, false);

Assert.IsFalse(IgnoreRecord, 'Service Item with blank Item No. should not be ignored by this filter.');
// [THEN] Native Field Service customer asset creation is disabled.
VerifySuccessfulIntegrationSynchJob(JobID, 0, 1);
CRMProduct.Get(CRMProduct.ProductId);
Assert.IsFalse(CRMProduct.ConvertToCustomerAsset, 'Convert to Customer Asset should be disabled.');
end;

[Test]
procedure DoNotIgnoreServiceItemWhenItemIsNotCoupled()
[TransactionModel(TransactionModel::AutoCommit)]
Comment thread
tomasevicst marked this conversation as resolved.
procedure ItemProductMappingDisablesCustomerAssetConversion()
var
Item: Record Item;
TempServiceItem: Record "Service Item" temporary;
RecordRef: RecordRef;
IgnoreRecord: Boolean;
CRMProduct: Record "CRM Product";
IntegrationFieldMapping: Record "Integration Field Mapping";
CRMSetupDefaults: Codeunit "CRM Setup Defaults";
begin
// [FEATURE] [Service Item Mapping]
// [SCENARIO] Service Item with uncoupled Item is not skipped by this filter.
// [FEATURE] [Item-Product Mapping]
// [SCENARIO] The item-product mapping always disables native Field Service customer asset creation.
Initialize();
InitSetup(true, '');

Item.Get(CreateItem());
TempServiceItem."Item No." := Item."No.";
RecordRef.GetTable(TempServiceItem);
// [WHEN] The default item-product mapping is reset.
CRMSetupDefaults.ResetItemProductMapping('ITEM-PRODUCT', false);

FSIntegrationTestLibrary.IgnoreServiceItemsByConvertToCustomerAssetFlag(RecordRef, IgnoreRecord);

Assert.IsFalse(IgnoreRecord, 'Service Item with uncoupled Item should not be ignored by this filter.');
// [THEN] Convert to Customer Asset is mapped to constant false in the outbound direction.
IntegrationFieldMapping.SetRange("Integration Table Mapping Name", 'ITEM-PRODUCT');
IntegrationFieldMapping.SetRange("Integration Table Field No.", CRMProduct.FieldNo(ConvertToCustomerAsset));
Assert.IsTrue(IntegrationFieldMapping.FindFirst(), 'The Convert to Customer Asset mapping should exist.');
Assert.AreEqual(0, IntegrationFieldMapping."Field No.", 'The mapping should use a constant value.');
Assert.AreEqual(IntegrationFieldMapping.Direction::ToIntegrationTable, IntegrationFieldMapping.Direction, 'The mapping should be outbound.');
Assert.AreEqual('false', IntegrationFieldMapping."Constant Value", 'The mapping should disable Convert to Customer Asset.');
end;

local procedure Initialize()
Expand Down Expand Up @@ -1712,6 +1705,49 @@ codeunit 139204 "FS Integration Test"
SetTenantLicenseStateToTrial();
end;

local procedure VerifySuccessfulIntegrationSynchJob(JobID: Guid; ExpectedInserted: Integer; ExpectedModified: Integer)
var
IntegrationSynchJob: Record "Integration Synch. Job";
IntegrationSynchJobErrors: Record "Integration Synch. Job Errors";
begin
IntegrationSynchJob.Get(JobID);
IntegrationSynchJobErrors.SetRange("Integration Synch. Job ID", JobID);
if IntegrationSynchJobErrors.FindFirst() then
Assert.Fail('Unexpected synchronization error: ' + IntegrationSynchJobErrors.Message);
IntegrationSynchJob.TestField(Failed, 0);
IntegrationSynchJob.TestField(Inserted, ExpectedInserted);
IntegrationSynchJob.TestField(Modified, ExpectedModified);
end;

local procedure CreateItemWithCoupledUnitOfMeasure(var Item: Record Item; var CRMUom: Record "CRM Uom")
var
ItemUnitOfMeasure: Record "Item Unit of Measure";
UnitGroup: Record "Unit Group";
CRMUomschedule: Record "CRM Uomschedule";
begin
LibraryCRMIntegration.CreateCoupledItemUnitGroupAndUomSchedule(UnitGroup, CRMUomschedule);
Item.GetBySystemId(UnitGroup."Source Id");
ItemUnitOfMeasure.Get(Item."No.", Item."Base Unit of Measure");
LibraryCRMIntegration.CoupleItemUnitOfMeasure(ItemUnitOfMeasure, CRMUomschedule, CRMUom);
end;

local procedure InitializeItemProductSynchronization()
var
CDSConnectionSetup: Record "CDS Connection Setup";
CRMConnectionSetup: Record "CRM Connection Setup";
begin
InitSetup(true, '');
LibraryCRMIntegration.ConfigureCRM();
LibraryCRMIntegration.CreateCRMOrganization();
CRMConnectionSetup.Get();
CRMConnectionSetup.Validate("Is Enabled", false);
CRMConnectionSetup.Modify(true);
CRMConnectionSetup.Validate("Is Enabled", true);
CRMConnectionSetup.Modify(true);
CDSConnectionSetup.Get();
CDSConnectionSetup.SetBaseCurrencyData();
end;

procedure ResetFSEnvironment()
var
FSConnectionSetup: Record "FS Connection Setup";
Expand Down Expand Up @@ -2018,4 +2054,3 @@ codeunit 139204 "FS Integration Test"
InventorySetup.Modify(true);
end;
}

Loading