ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Scope Change] - codeunit 7204 "CDS Setup Defaults"

Open RasmusTorpeRIT opened this issue 3 years ago • 4 comments

Base application version 21.2.49946.51093 (DK Localization)

For codeunit 7204 "CDS Setup Defaults" the reset functions for the dataverse intgration are tagget with [Scope('OnPrem')]:

[Scope('OnPrem')]
procedure ResetSalesPeopleSystemUserMapping

[Scope('OnPrem')]
procedure ResetCustomerAccountMapping

[Scope('OnPrem')]
procedure ResetVendorAccountMapping

[Scope('OnPrem')]
procedure ResetContactContactMappin

[Scope('OnPrem')]
procedure ResetCurrencyTransactionCurrencyMapping

[Scope('OnPrem')]
procedure ResetPaymentTermsMapping

[Scope('OnPrem')]
procedure ResetShipmentMethodMapping

[Scope('OnPrem')]
procedure ResetShippingAgentMapping

This makes it hard to extend the standard fields mapping as described here because the ResetCustomerAccountMapping procedure does not run..

Please remove the onPrem scope from the Reset* procedures - and also from the sales integration..

Thank you - and merry christmas!

RasmusTorpeRIT avatar Dec 23 '22 13:12 RasmusTorpeRIT

Request rejected. Subscribe to the events that are dedicated for overriding the defaults:

"CDS Setup Defaults" codeunit

// after someone chooses 'Use Default Synchronization Setup' on Dataverse Connection Setup.
// here is where you can code your defaults
[IntegrationEvent(false, false)]
local procedure OnAfterResetConfiguration(CDSConnectionSetup: Record "CDS Connection Setup")
begin
end;

// more granular event for Customer-Account mapping
[IntegrationEvent(false, false)]
local procedure OnAfterResetCustomerAccountMapping(IntegrationTableMappingName: Code[20])
begin
end;

// more granular event for Vendor-Account mapping
[IntegrationEvent(false, false)]
local procedure OnAfterResetVendorAccountMapping(IntegrationTableMappingName: Code[20])
begin
end;

// more granular event for Contact mapping
[IntegrationEvent(false, false)]
local procedure OnAfterResetContactContactMapping(IntegrationTableMappingName: Code[20])
begin
end;

"CRM Setup Defaults" codeunit // after someone chooses 'Use Default Synchronization Setup' on Microsoft Dynamics 365 Connection Setup. // here is where you can code your defaults [IntegrationEvent(false, false)] local procedure OnAfterResetConfiguration(CRMConnectionSetup: Record "CRM Connection Setup") begin end;

// more granular events for each mapping

[IntegrationEvent(false, false)]
local procedure OnResetItemProductMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetOpportunityMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetPriceListHeaderPricelevelMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetPriceListLineProductPricelevelMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetResourceProductMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetSalesInvoiceHeaderInvoiceMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetSalesInvoiceLineInvoiceMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetSalesOrderMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetBidirectionalSalesOrderMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

[IntegrationEvent(false, false)]
local procedure OnResetBidirectionalSalesOrderLineMappingOnAfterInsertFieldsMapping(IntegrationTableMappingName: Code[20])
begin
end;

dcenic avatar Jan 09 '23 14:01 dcenic

Hi

Thank you for the reply - I am indeed trying to subscribe to the events but they are not raised since the procedure that should raise them are marked as [Scope('OnPrem')]..

Example: Consider the publisher OnAfterResetCustomerAccountMapping - it is only raised inside the ResetCustomerAccountMapping and therefore never raised in a BC online environment..

RasmusTorpeRIT avatar Jan 10 '23 09:01 RasmusTorpeRIT

There are three ways to make sure this method will be called: First way (if setup is not enabled before) Open Dataverse Connection Setup Enable the setup

Second way (this is if the setup is already enabled) Open Dataverse Connection Setup Choose action 'Use Default Synchronization Setup'

Third Way (this is if the setup is already enabled) Open Integration Table Mappings Select CUSTOMER Mapping Choose 'Use Default Synchronization Setup'

dcenic avatar Jan 10 '23 12:01 dcenic

You're right - somehow my subscriber was not called (probably delay in deploy..) but now it's called as expected.

I can work from here - ticket can be closed.

Thank you

RasmusTorpeRIT avatar Jan 10 '23 12:01 RasmusTorpeRIT