microsoft / microsoft/BCApps

[Event Request] Report 31012 "Create Sales Adv. Letter CZZ".OnPostReport

Open
#11,020 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved event-request Team: Finance
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Why do you need this change?

Problem statement:
Our module works with web orders and this require skip confirmations during Sales Advance Header create. We ask for option how to skip confirmations during this process for automatic tasks.

Alternatives evaluated:
There is no event that allow skip confirmation dialog and skip open page.

Proposed publisher location:
Object: Report 31012 "Create Sales Adv. Letter CZZ".OnPostReport near to confirmation codeunit.

Proposed code snippet (before -> after):

trigger OnPostReport()
var
    ConfirmManagement: Codeunit "Confirm Management";
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:BEGIN
    IsHandled: Boolean;
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:END
    OpenAdvanceLetterQst: Label 'Do you want to open created Advance Letter?';
begin
    case SourceType of
        SourceType::SalesOrder:
            begin
                CreateAdvanceLetterHeader(SourceSalesHeader);
                CreateAdvanceLetterLine(TempSalesLine);
                CreateAdvanceLetterApplication();
            end;
        SourceType::Job:
            begin
                CreateAdvanceLetterHeader(SourceJob);
                CreateAdvanceLetterLine(TempJobPlanningLine);
            end;
        SourceType::JobTask:
            begin
                CreateAdvanceLetterHeader(SourceJobTask);
                CreateAdvanceLetterLine(TempJobPlanningLine);
            end;
    end;
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:BEGIN
    OnPostReportOnBeforeConfitmOpenAdvanceLetter(SalesAdvLetterHeaderCZZ, IsHandled);
    if not IsHandled then
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:END
        if ConfirmManagement.GetResponseOrDefault(OpenAdvanceLetterQst, false) then
            if GuiAllowed() then
                Page.Run(Page::"Sales Advance Letter CZZ", SalesAdvLetterHeaderCZZ);
end;

//------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:BEGIN
[IntegrationEvent(false, false)]
local procedure OnPostReportOnBeforeConfitmOpenAdvanceLetter(SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ"; var IsHandled: boolean)
begin
end;
//------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:END

Performance & data considerations:
There is no addition cycles and actions so there don't change performance. Data are not affected because everything is created only show card will be skipped.

Multi‑extension interaction:
There is no conflict with another extension because it doesn't skip function or procedures with events.

Justification for using IsHandled over alternatives:
We tried find another solution, but there is no another option then isHandled.

Describe the request
trigger OnPostReport()
var
    ConfirmManagement: Codeunit "Confirm Management";
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:BEGIN
    IsHandled: Boolean;
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:END
    OpenAdvanceLetterQst: Label 'Do you want to open created Advance Letter?';
begin
    case SourceType of
        SourceType::SalesOrder:
            begin
                CreateAdvanceLetterHeader(SourceSalesHeader);
                CreateAdvanceLetterLine(TempSalesLine);
                CreateAdvanceLetterApplication();
            end;
        SourceType::Job:
            begin
                CreateAdvanceLetterHeader(SourceJob);
                CreateAdvanceLetterLine(TempJobPlanningLine);
            end;
        SourceType::JobTask:
            begin
                CreateAdvanceLetterHeader(SourceJobTask);
                CreateAdvanceLetterLine(TempJobPlanningLine);
            end;
    end;
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:BEGIN
    OnPostReportOnBeforeConfitmOpenAdvanceLetter(SalesAdvLetterHeaderCZZ, IsHandled);
    if not IsHandled then
    //------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:END
        if ConfirmManagement.GetResponseOrDefault(OpenAdvanceLetterQst, false) then
            if GuiAllowed() then
                Page.Run(Page::"Sales Advance Letter CZZ", SalesAdvLetterHeaderCZZ);
end;

//------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:BEGIN
[IntegrationEvent(false, false)]
local procedure OnPostReportOnBeforeConfitmOpenAdvanceLetter(SalesAdvLetterHeaderCZZ: Record "Sales Adv. Letter Header CZZ"; var IsHandled: boolean)
begin
end;
//------------------------------------------OnPostReportOnBeforeConfitmOpenAdvanceLetter:END


Provide an implementation (optional)
  • I will provide the implementation for this extensibility request

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate report 31012 "Create Sales Adv. Letter CZZ" and inspect its OnPostReport trigger around Confirm Management and the "Sales Advance Letter CZZ" page run. Verify the extensibility point supports automatic tasks that need to skip the confirmation and page opening, then validate the report still creates the advance letter data as before.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.