I have no problem in sending mail, but I have to sent mail only when I create a new vendor card so
This is code I tried is there any modifications needed?
codeunit 50132 "Alert for New Vendor Creation"
{
[EventSubscriber(ObjectType::Table, Database::Vendor, 'OnAfterModifyEvent', '', true, true)]
procedure AlertVendor(var Rec: Record Vendor; xRec: Record Vendor)
var
rec_Vendor: Record Vendor;
begin
if rec_Vendor.FindSet() then
repeat
Message('%1',rec_Vendor."No.")
InsertIntotable (rec_Vendor)
until rec_Vendor.Next() = 0;
end;
procedure InsertIntoTable(rec_Vendor: Record Vendor)
var
rec_AlertNewVendor: Record "Alert New Vendor Creation";
begin
rec_AlertNewVendor.Init();
rec_AlertNewVendor.No := CreateGuid();
rec_AlertNewVendor."Account Code" := rec_Vendor."No.";
rec_AlertNewVendor.Name := rec_Vendor.Name;
rec_AlertNewVendor."Date of Creation" := rec_Vendor.SystemCreatedAt;
rec_AlertNewVendor.User := rec_Vendor.SystemCreatedBy;
end;
So here when I create an new vendor card i need to get the message and table with these fields.