Hi,
I’m using this link to https://asiablog.acumatica.com/2017/05/sending-notification-template-from.html no send a custom notification, but for some reason is not working, the sender.send() return an empty list. I’m using a custom graph and DAC. The form have the ActivityIndicator equal to true. What I’m doing wrong?
This is my code.
protected static void SendEmail(string message, PXGraph Base, CustomDAC transaction)
{
Notification notification = PXSelect<Notification,
Where<Notification.name, Equal<Required<Notification.name>>>>
.Select(Base, new object ] { "my template" });
bool sent = false;
string sError = "Failed to send E-mail.";
try
{
TemplateNotificationGenerator sender = TemplateNotificationGenerator.Create(transaction, notification.NotificationID.Value);
sender.MailAccountId = (notification.NFrom.HasValue)
? notification.NFrom.Value
: PX.Data.EP.MailAccountManager.DefaultMailAccountID;
sender.RefNoteID = transaction.Noteid;
//sender.Owner = notification.NFrom;
sender.To = notification.NTo;
sender.Body = notification.Body.Replace("((#replace#))", message);
var activitieds = sender.Send();
}
catch (Exception ex)
{
sent = false;
sError = ex.Message;
}
}
Thanks,
EV