Why do you need this change?
We need to bypass the standard Microsoft logic in this procedure because we have a separate feature that already handles the assignment of the VAT Registration No. and the relevant posting groups.
Without an IsHandled pattern, the Microsoft logic is always executed and may overwrite or conflict with the values set by our own feature.
Describe the request
Please add an OnBeforeUpdateSetupOnBillToCustomerChangeInSalesHeader integration event before calling AltCustVATRegFacade.UpdateSetupOnBillToCustomerChangeInSalesHeader(Rec, xRec, BillToCustomer) in procedure SetBillToCustomerAddressFieldsFromCustomer.
The event should provide an IsHandled parameter so subscribers can skip the mentioned call when they handle the logic themselves.
Requested change:
(from)
procedure SetBillToCustomerAddressFieldsFromCustomer(var BillToCustomer: Record Customer)
var
IsHandled: Boolean
begin
[...]
if "Document Type" in ["Document Type"::"Credit Memo", "Document Type"::"Return Order"] then begin
"Payment Method Code" := '';
if PaymentTerms.Get("Payment Terms Code") then
if PaymentTerms."Calc. Pmt. Disc. on Cr. Memos" then
"Payment Method Code" := BillToCustomer."Payment Method Code"
end else
"Payment Method Code" := BillToCustomer."Payment Method Code";
AltCustVATRegFacade.UpdateSetupOnBillToCustomerChangeInSalesHeader(Rec, xRec, BillToCustomer);
[...]
end;
(to)
procedure SetBillToCustomerAddressFieldsFromCustomer(var BillToCustomer: Record Customer)
var
IsHandled: Boolean
begin
[...]
if "Document Type" in ["Document Type"::"Credit Memo", "Document Type"::"Return Order"] then begin
"Payment Method Code" := '';
if PaymentTerms.Get("Payment Terms Code") then
if PaymentTerms."Calc. Pmt. Disc. on Cr. Memos" then
"Payment Method Code" := BillToCustomer."Payment Method Code"
end else
"Payment Method Code" := BillToCustomer."Payment Method Code";
>>>
IsHandled := false;
OnBeforeUpdateSetupOnBillToCustomerChangeInSalesHeader(Rec, xRec, BillToCustomer, IsHandled);
if not IsHandled then
AltCustVATRegFacade.UpdateSetupOnBillToCustomerChangeInSalesHeader(Rec, xRec, BillToCustomer);
<<<
[...]
end;
>>>
[IntegrationEvent(false, false)]
local procedure OnBeforeUpdateSetupOnBillToCustomerChangeInSalesHeader(var SalesHeader: Record "Sales Header"; var OldSalesHeader: Record "Sales Header"; BillToCustomer: Record Customer; var IsHandled: Boolean)
begin
end;
<<<
Why do you need this change?
We need to bypass the standard Microsoft logic in this procedure because we have a separate feature that already handles the assignment of the VAT Registration No. and the relevant posting groups.
Without an IsHandled pattern, the Microsoft logic is always executed and may overwrite or conflict with the values set by our own feature.
Describe the request
Please add an OnBeforeUpdateSetupOnBillToCustomerChangeInSalesHeader integration event before calling AltCustVATRegFacade.UpdateSetupOnBillToCustomerChangeInSalesHeader(Rec, xRec, BillToCustomer) in procedure SetBillToCustomerAddressFieldsFromCustomer.
The event should provide an IsHandled parameter so subscribers can skip the mentioned call when they handle the logic themselves.
Requested change:
(from)
(to)