web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

While creating the Payment or receipt entry for some particular GL or customer account, I need to send one email notification to the employees.

(0) ShareShare
ReportReport
Posted on by 29

Dear Team, 

Can you pls help me with my query? 

While creating the Payment or receipt entry for some particular GL or customer account, I need to send one email notification to the employees.

Thanks 

Dileep G

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    You need to customise the solution to achieve this

    Thanks

  • Dileep Gopinathan Profile Picture
    29 on at

    Thanks for your quick reply, the Email notification process is how I can enable it.

    ----- Below process we are planning.

    1. Creation of New Boolean “Email notify” in the below pages

    a. Chart of Account

    b. Customer

    c. Vendor

    2. If the “Email Notify” Boolean is true, then System will send an auto email with the below details whenever the user will pass a Payment or receipt entry using the “Email notify” boolean true CL/Vendor/Customer

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Yes you can convey your requirements to your developer to customise this for you

  • Dileep Gopinathan Profile Picture
    29 on at

    codeunit 80123 SendEmailGL

    {

       Permissions =

        tabledata "Gen. Journal Line" = R;

       [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterGLFinishPosting', '', false, false)]

       local procedure OnAfterGLFinishPosting(GLEntry: Record "G/L Entry"; var GenJnlLine: Record "Gen. Journal Line"; IsTransactionConsistent: Boolean; FirstTransactionNo: Integer; var GLRegister: Record "G/L Register"; var TempGLEntryBuf: Record "G/L Entry" temporary; var NextEntryNo: Integer; var NextTransactionNo: Integer)

    OnAfterPostGenJnlLine(GenJnlLine5, SuppressCommit, GenJnlPostLine, IsPosted, GenJournalLine);

       var

           //         //SmtpMailSetup: Record "SMTP Mail Setup";

           //         //Mail: Codeunit "SMTP Mail";

           EmailMessage: Codeunit "Email Message";

           Email: Codeunit Email;

           Recipients: List of [Text];

           gldetails: Record "Gen. Journal Line";

           main: Decimal;

           Subject: Text;

           Body: Text;

           GLPostedTitle: Label 'The GL Document %2 of Customer %1 has been posted.';

           GLPostedMsg: Label 'Dear Manager<br><br>The GL Document <font color="red"><strong>%2</strong></font> of Customer <strong>%1</strong> has been posted.<br> The total amount is <strong>%3</strong>. <br>The Posted Invoice Number is <strong>%4</strong>. <br> User ID <strong>%5</strong>';

       begin

           Recipients.Add('dileep.gopinathan@maglube.ae');

           Recipients.Add('it@maglube.ae');

           // GenJnlLine.CalcFields("Bal. VAT Amount (LCY)");

           // GenJnlLine.flowfiled

           //Main := gldetails.Amount;

           Subject := StrSubstNo(GLPostedTitle, GenJnlLine.SystemCreatedBy, GenJnlLine.Description);

           Body := StrSubstNo(GLPostedMsg, GenJnlLine."Amount (LCY)", GenJnlLine."Due Date");

           EmailMessage.Create(Recipients, Subject, Body, true);

           Email.Send(EmailMessage, Enum::"Email Scenario"::Default);

       end;

    }

  • Dileep Gopinathan Profile Picture
    29 on at

    I am getting error for this code ., can you pls help me for this

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi,

    Can you try this?

    codeunit 50100 SendEmailGL

    {

       Permissions = tabledata "Gen. Journal Line" = R;

       [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterGLFinishPosting', '', false, false)]

       local procedure OnAfterGLFinishPostingGL(GLEntry: Record "G/L Entry"; var GenJnlLine: Record "Gen. Journal Line"; IsTransactionConsistent: Boolean; FirstTransactionNo: Integer; var GLRegister: Record "G/L Register"; var TempGLEntryBuf: Record "G/L Entry" temporary; var NextEntryNo: Integer; var NextTransactionNo: Integer)

       var

           EmailMessage: Codeunit "Email Message";

           Email: Codeunit Email;

           Recipients: List of [Text];

           gldetails: Record "Gen. Journal Line";

           main: Decimal;

           Subject: Text;

           Body: Text;

           GLPostedTitle: Label 'The GL Document %2 of Customer %1 has been posted.';

           GLPostedMsg: Label 'Dear Manager<br><br>The GL Document <font color="red"><strong>%2</strong></font> of Customer <strong>%1</strong> has been posted.<br> The total amount is <strong>%3</strong>. <br>The Posted Invoice Number is <strong>%4</strong>. <br> User ID <strong>%5</strong>';

       begin

           Recipients.Add('palindrome.nitin@gmail.com');

           Recipients.Add('nverma@conceptcloudservices.com');

           Subject := StrSubstNo(GLPostedTitle, GenJnlLine.SystemCreatedBy, GenJnlLine.Description);

           Body := StrSubstNo(GLPostedMsg, GenJnlLine."Amount (LCY)", GenJnlLine."Due Date");

           EmailMessage.Create(Recipients, Subject, Body, true);

           Email.Send(EmailMessage);

       end;

    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans