Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

how to add new send email functionality?

(0) ShareShare
ReportReport
Posted on by

I have added new action send email in the job card .

  • when sending this email I need attach a custom report , there is already a action send email for job order  I made a duplicate of this and now i need to change the attachment .
  • I have extended report selections usage and added the a new usage and added my report in the pages and table(report selections job)
  • how can i change the the attachment???
  • is there any event subscriber for that any idea??
  • Suggested answer
    Nitin Verma Profile Picture
    21,544 Moderator on at
    RE: how to add new send email functionality?

    Hi,

    Go to the Replay Layout > Search Your report > Replace Layout by importing the correct layout > Set as default.

    pastedimage1663903748378v1.png

    Thanks.

  • Community Member Profile Picture
    on at
    RE: how to add new send email functionality?

    pastedimage1663848444059v1.png

    Report selection is all done properly but still it is taking the standard.

    is there any way by coding we can directly assign  the required report ??

  • Suggested answer
    Amit Baru Profile Picture
    3,029 on at
    RE: how to add new send email functionality?

    Hi

    Pls check Open the Report selection page and check the Report ID.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Community Member Profile Picture
    on at
    RE: how to add new send email functionality?

    In the report selection page for job

    usage is marked correctly, and selected the correct layout of the report still it is taking the standard report.

  • Suggested answer
    Nitin Verma Profile Picture
    21,544 Moderator on at
    RE: how to add new send email functionality?

    Hi,

    You need to attached the correct report in the report selection page first, and then please try again,

    Go to Report Selection - Job

    Thanks.

  • Community Member Profile Picture
    on at
    RE: how to add new send email functionality?
    This is my codeunit :
        trigger OnRun()
        begin

        end;

        procedure EmailSalesHeader(job: Record "Job")
        begin
            DoPrintSalesHeader(job, true);
        end;

        local procedure DoPrintSalesHeader(job: Record Job; SendAsEmail: Boolean)
        var
            ReportSelections: Record "Report Selections";
            ReportUsage: Enum "Report Selection Usage";
            IsPrinted: Boolean;
        begin
            ReportUsage := GetSalesDocTypeUsage();
            job.SetRange("No.", job."No.");
            if IsPrinted then
                exit;

            if SendAsEmail then
                ReportSelections.SendEmailToCust(
                    ReportUsage.AsInteger(), job, job."No.", job.Description, true, job."Bill-to Customer No.", 0)
            else
                ReportSelections.PrintForCust(ReportUsage, job, job.FieldNo("Bill-to Customer No."));
        end;

        procedure GetSalesDocTypeUsage() ReportSelectionUsage: Enum "Report Selection Usage"
        var
            ReportSelections: Record "Report Selections";
            TypeUsage: Integer;
            IsHandled: Boolean;
        begin

            exit(ReportSelections.Usage::"JC") //here i have assigned the report selection
        end;

    //but still taking the standard report. where i went wrong? Nitin Verma 
  • Suggested answer
    Nitin Verma Profile Picture
    21,544 Moderator on at
    RE: how to add new send email functionality?

    Hi,

    Can you please share you code what you have tried till now?

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,996 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans