thanks for replay ievgen Miroshnikov and how to select particular PO means i am confriming one po only so i nedd to select that po only....
how to pass arguments can you please help me this is my code
this is my job.thanks in advance
static void ITTI_EmailTrigger(Args _args)
{
SysEmailParameters parameters = SysEmailParameters::find();
SMTPRelayServerName relayServer;
SMTPPortNumber portNumber;
SMTPUserName userName;
SMTPPassword password;
Str1260 subject ;
InteropPermission interopPermission;
SysMailer mailer = new SysMailer();
System.Exception e;
PurchTable PurchTable;
PurchLine PurchLine;
str PurchaseId;
str ItemId,ItemName,Qty,UnitPrice,NetAmount;
str htmlstr;
int i;
if (parameters.SMTPRelayServerName)
{
relayServer = parameters.SMTPRelayServerName;
portNumber = parameters.SMTPPortNumber;
userName = parameters.SMTPUserName;
password = SysEmailParameters::password();
}
else
//relayServer = parameters.SMTPRelayServerName;
{
relayServer = parameters.SMTPServerIPAddress;
portNumber = parameters.SMTPPortNumber;
userName = parameters.SMTPUserName;
password = SysEmailParameters::password();
}
subject = "Update On Purchase Order";
while select PurchTable join PurchLine where PurchTable.PurchId==PurchLine.PurchId && PurchTable.DocumentState==VersioningDocumentState::Confirmed
&& PurchLine.PurchId=='INMF-000082'
{
PurchaseId=PurchTable.PurchId;
ItemId=PurchLine.ItemId;
ItemName=PurchLine.Name;
Qty=num2str(PurchLine.PurchQty,10,3,1,2);
UnitPrice=num2str(PurchLine.PurchPrice,10,3,1,2);
NetAmount=num2str(PurchLine.LineAmount,10,3,1,2);
if(i==1)
{
htmlstr+="<html>";
htmlstr+='<P>Dear Sir/Madam The purchase OrderNumber '+PurchaseId+' has been confimed.The Details as follows</P>';
}
i++;
}
CodeAccessPermission::revertAssert();
try
{
interopPermission = new InteropPermission(InteropKind::ComInterop);
interopPermission.assert();
//instantiate email
mailer.fromAddress(userName);
// mailer.tos().appendAddress("shravan.j@itti.com");
mailer.tos().appendAddress("kartheek.mv@itti.com");
mailer.SMTPRelayServer(relayServer,portNumber,userName,password, parameters.NTLM);
mailer.subject(subject);
mailer.htmlBody(htmlstr);
mailer.sendMail();
CodeAccessPermission::revertAssert();
info("Email has been send!");
}
catch (Exception::CLRError)
{
e = ClrInterop::getLastException();
while (e)
{
info(e.get_Message());
e = e.get_InnerException();
}
CodeAccessPermission::revertAssert();
info ("Failed to Send Email some Error occure");
}
}