microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
773 stars 610 forks source link

[Event Request] Add OnBeforeWriteFile in codeunit 12134 "Declaration of Intent Export" #26718

Closed fifr-reply closed 2 months ago

fifr-reply commented 3 months ago

Describe the request

Could you please add an event OnBeforeWriteFile in procedure Export within codeunit 12134 "Declaration of Intent Export", so one can access and modify the values taken from record Company Information, if needed?

Current code:

procedure Export(var VATExemption: Record "VAT Exemption"; DescriptionOfGoods: Text[100]; SigningCompanyOfficialNo: Code[20]; AmountToDeclare: Decimal; CeilingType: Option "Fixed",Mobile; ExportFlags: array[6] of Boolean; SupplementaryReturn: Boolean; TaxAuthorityReceiptsNo: Text[17]; TaxAuthorityDocNo: Text[6]): Boolean
var
    SigningCompanyOfficials: Record "Company Officials";
begin
    VATExemption.TestField(Type, VATExemption.Type::Vendor);
    if not SigningCompanyOfficials.Get(SigningCompanyOfficialNo) then
        Error(NoSigningCompanyOfficialErr);
    if AmountToDeclare <= 0 then
        Error(NoAmountToDeclareErr);

    CompanyInformation.Get();

    FlatFileManagement.Initialize();
    FlatFileManagement.StartNewFile();

Suggested code:

procedure Export(var VATExemption: Record "VAT Exemption"; DescriptionOfGoods: Text[100]; SigningCompanyOfficialNo: Code[20]; AmountToDeclare: Decimal; CeilingType: Option "Fixed",Mobile; ExportFlags: array[6] of Boolean; SupplementaryReturn: Boolean; TaxAuthorityReceiptsNo: Text[17]; TaxAuthorityDocNo: Text[6]): Boolean
var
    SigningCompanyOfficials: Record "Company Officials";
begin
    VATExemption.TestField(Type, VATExemption.Type::Vendor);
    if not SigningCompanyOfficials.Get(SigningCompanyOfficialNo) then
        Error(NoSigningCompanyOfficialErr);
    if AmountToDeclare <= 0 then
        Error(NoAmountToDeclareErr);

    CompanyInformation.Get();

    OnBeforeWriteFile(VATExemption, CompanyInformation);

    FlatFileManagement.Initialize();
    FlatFileManagement.StartNewFile();
[IntegrationEvent(false, false)]
local procedure OnBeforeWriteFile(var VATExemption: Record "VAT Exemption"; var CompanyInformation: Record "Company Information")
begin
end;

Additional context

We have a business scenario where contact information to be included in the exported file differs from the ones stored in fields "E-Mail" or "Phone No." of table Company Information (the customer has a dedicated e-mail address for this particular document). Internal work item: AB#539236

JesperSchulz commented 2 months ago

Availability update: We will publish a fix for this issue in the next update for release 24.

Build ID to track: 21676.

JesperSchulz commented 2 months ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 21691.