Announcements
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
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;
}
I am getting error for this code ., can you pls help me for this
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;
}
Yes you can convey your requirements to your developer to customise this for you
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
Hi,
You need to customise the solution to achieve this
Thanks
André Arnaud de Cal...
294,206
Super User 2025 Season 1
Martin Dráb
232,968
Most Valuable Professional
nmaenpaa
101,158
Moderator