PurchLine purchLine;
PurchLineAmount poAmount;
Map templateTokens;
str emailSubject,body;
templateTokens = new Map(Types::String, Types::String);
boolean ret = false;
emailSubject = "Open PO list above one CR and above 180 days";
templateTokens.insert("@
body = '<p>Dear Team,</p>';
body+= '<p>Open PO details listed below which exceeds the 180 days.</p>';
body+= '<table style="border-collapse: collapse; width: 100%;" border="1">';
body+= '<tbody>';
body+= '<tr>';
body+= '<td style="width: 16.6667%;"><strong>Purchase Id</strong></td>';
body+= '<td style="width: 16.6667%;"><strong>Purchase name</strong></td>';
body+= '<td style="width: 16.6667%;"><strong>Vendor Id</strong></td>';
body+= '<td style="width: 16.6667%;"><strong>Vendor name</strong></td>';
body+= '<td style="width: 16.6667%;"><strong>Purchase amount</strong></td>';
body+= '</tr>';
try
{
while select purchTable // write your custom logic
{
ret = true;
body+= '<tr>';
body+= '<td style="width: 16.6667%;">';
body+= strFmt('%1', purchTable.PurchId);
body+= '</td>';
body+= '<td style="width: 16.6667%;">';
body+= strFmt('%1', purchTable.PurchName);
body+= '</td>';
body+= '<td style="width: 16.6667%;">';
body+= strFmt('%1', purchTable.OrderAccount);
body+= '</td>';
body+= '<td style="width: 16.6667%;">';
body+= strFmt('%1', VendTable::find(purchTable.
body+= '</td>';
body+= '<td style="width: 16.6667%;">';
body+= strFmt('%1', poAmount);
body+= '</td>';
body+= '</tr>';
}
if(ret)
{
SysEmailParameters emailParameters = SysEmailParameters::find();
SysMailerMessageBuilder messageBuilderloc = new SysMailerMessageBuilder();
messageBuilderloc.setFrom(
messageBuilderloc.addTo("TOMAIL");
//messageBuilder.addCc(_
messageBuilderloc.setSubject(
messageBuilderloc.setBody(
SysMailerFactory::
info("Mail alert operation completed");
}
}
catch(Exception::Error)
{
throw Exception::Error;
}
----------------
Output :
No comments:
Post a Comment