The following Workflow will send an email to the Billing Contact when a Payment is added to the Account.
If you are unfamiliar with Workflows in EngageIP see: EngageIP Workflow Engine Overview
Sample Email
Dear Bill Smith,
Thank you for your continued business. Your payment has been received.
Our records indicate the following to be outstanding:
Invoice # | Balance | Due Date |
44 | $525.00 | 7/10/2009 |
43 | $525.00 | 7/10/2009 |
42 | $326.00 | 7/10/2009 |
If you have any questions regarding your account please do not hesitate to contact us.
Best regards,
LogiSense
Customer Care: 1-519-249-0508
Website: http://www.logisense.com
Support Portal: https://support.logisense.com/customerportal
Knowledge Base: https://kb.logisense.com
If there is Still a Balance owning the E-mail will include the Invoices that are still open requiring Payment.
Configuration
Workflow Event
Name: “Payment”
Event Code: Payment.Create
Action Script
Name: “Send e-mail on Payment”
Script: see below
Payment pay = Payment.GetByID(Convert.ToInt32(context["PaymentID"])); User user = User.GetByID(pay.GetUser().ID); ContactTypeQuery ctq = new ContactTypeQuery(); int contactname = 0; ctq.Name = "Billing Contact"; ctq.OwnerIDMin = user.ActingOwnerID; ctq.OwnerIDMax = user.ActingOwnerID; foreach(ContactType ct in ContactType.GetCollection(ref ctq)) { contactname = ct.ID; } Contact contact = Contact.GetByID(user.SearchContactByContactTypeID(contactname)[0].ID); //Logic.Core.Alert.Create(contact.FirstName.ToString(), 1); ViewUserBalanceFuture vubf = ViewUserBalanceFuture.SearchByUserID(user.ID)[0]; ViewUserBalance vub = ViewUserBalance.SearchByUserID(user.ID)[0]; String tableheader = ""; String body2 = ""; String table = ""; String bodybalance = ""; String body = "<img alt="http://www.logisense.com/images/logo_logisense.jpg" /> <span style="font-family: calibri;">Dear " + contact.FirstName.ToString() + " " + contact.LastName.ToString() + ",</span> Thank you for your continued business. Your payment has been received. "; if (vubf.Balance <= 0) { body2 = "<span style="color: #c00000; font-family: calibri;">Your current account balance is </span>" + vubf.Balance.ToString("C") + " "; } else { bodybalance = "<span style="color: red; font-family: calibri;">Our records indicate the following to be outstanding:</span> "; tableheader = " <span style="color: #6666ff; font-family: calibri;">Invoice #</span><span style="color: #6666ff; font-family: calibri;">Balance</span><span style="color: #6666ff; font-family: calibri;">Due Date</span> "; ViewInvoiceQuery viq = new ViewInvoiceQuery(); viq.Paid = false; viq.UserIDMin = user.ID; viq.UserIDMax = user.ID; viq.SortField = "DueDate"; viq.SortOrder = 1; foreach (ViewInvoice inv in ViewInvoice.GetCollection(ref viq)) { table += " <span style="color: #6666ff; font-family: calibri;"><strong>" + inv.ID.ToString() + "</strong></span><span style="color: #6666ff; font-family: calibri;"><strong>" + inv.Balance.ToString("C") + "</strong></span><span style="color: #6666ff; font-family: calibri;"><strong>" + inv.DueDate.ToShortDateString() + "</strong></span> "; } } String footer = "<span style="font-family: calibri;">If you have any questions regarding your account please do not hesitate to contact us.</span> Best regards, LogiSense <strong>Customer Care: </strong>1-519-249-0508 <strong>Website: </strong>http://www.logisense.com <strong>Support Portal: </strong>https://support.logisense.com <strong>Knowledge Base: </strong>https://kb.logisense.com"; User rkozub = User.GetByName("rkozub"); Logisense.Boss.Logic.Email.SendToBillingContacts(user,"Thank You For Your Payment",body + body2 + bodybalance + " " + tableheader + table + " " + footer + "", null); Logisense.Boss.Logic.Email.SendToBillingContacts(rkozub, "Thank You For Your Payment", body + body2 + bodybalance + " " + tableheader + table + " " + footer + "", null); return true;