ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Report 11703 "Accounting Sheets CZL" - trigger OnInitReport()

Open jlorenc01 opened this issue 2 years ago • 5 comments

Describe the request

Hello,

I would like to ask for a new publisher in the report 11703 "Accounting Sheets CZL", trigger OnInitReport(). We need to change a value of the GroupGLAccounts. Thank you.

trigger OnInitReport()
begin
    GroupGLAccounts := true;
    OnAfterOnInitReport(GroupGLAccounts);
end;

// NEW EVENT
[IntegrationEvent(true, false)]
local procedure OnAfterOnInitReport(var GroupGLAccounts: Boolean)
begin
end;

Additional context

We need to change a value of the GroupGLAccounts. Internal work item: AB#496821

jlorenc01 avatar Jan 15 '24 09:01 jlorenc01

@jlorenc01 Hello. Is it really necessary to add this event when request 25702 asks for change the access scope of the variable GroupGLAccounts to protected?

DavidHolusa avatar Jan 20 '24 09:01 DavidHolusa

@DavidHolusa Hello, I think so. With the protected GroupGLAccounts we can change the default value on the request page or add some code conditioned by this variable. But when the report is run without the request page (i.e. with the action Post & Print on the Purchase Invoice), we cannot change the value because there is no OnAfterInit trigger in the report extension.

jlorenc01 avatar Jan 22 '24 09:01 jlorenc01

@jlorenc01 The solution for you would be to add the InitializeRequest function (see below).

procedure InitializeRequest(NewGroupGLAccounts: Boolean)
begin
    GroupGLAccounts := NewGroupGLAccounts;
end;

Is it ok for you?

DavidHolusa avatar Jan 22 '24 12:01 DavidHolusa

@DavidHolusa No, it is not a solution. We are talking about the action "Post and Print" on the page 51 "Purchase Invoice", it means the CU 92 "Purch.-Post + Print". After the document is posted, reports are printed via the procedure PrintRecords(ShowRequestPage: Boolean) defined in the table 122 "Purch. Inv. Header". image

It finds all reports with the defined report usage (in our case "P.Invoice") and print reports via Report.RunModal(ReportId, ...). So we do not have the report as the variable to be able to call some procedure within the report. image

jlorenc01 avatar Jan 22 '24 13:01 jlorenc01

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: 15718.

JesperSchulz avatar Jan 29 '24 08:01 JesperSchulz