while select AccountNum, TransDate from vendTrans group by vendTrans.AccountNum where vendTrans.TransDate==fromdate
{
Info(vendTrans.AccountNum);
if( localAccount != vendTrans.AccountNum)
{
select AccountNum ,party from vendTable where vendTable.AccountNum==vendTrans.AccountNum
join Name from partyTable where partyTable.RecId==vendTable.Party join
Locator from logisticsElectronicAddress where logisticsElectronicAddress.RecId==partyTable.PrimaryContactEmail;
str emails = logisticsElectronicAddress.Locator;
mailer.addTo(emails);
mailer.setSubject(strFmt(" Payment Details - %1 %2",vendTable.AccountNum,partyTable.Name));
body = "Hi Dear " + strFmt(" %1 <br/><br/> Vendor Account No. : %2 <br/> ",partyTable.Name,vendTable.AccountNum) ;
}
localAccount = vendTable.AccountNum;
}
mailer.setBody(body,true) ;
SysMailerFactory::getNonInteractiveMailer().sendNonInteractive(mailer.getMessage()) ;
this query outputs two accounts INMF01 And INMF05 , now data needs to be sent to their primary email address we have added lets suppose x1@gmail.com and x2@gmail.com(picking from locator in logistics electronic address) for both accounts respectively but this query is also sending INMF05 to x1@gmail.com also , only INMF01 to x1@gmail.com and INMF to X2@gmail.com needs to be sent
thankyou it worked
I think you want something like this:
while select AccountNum from vendTrans group by vendTrans.AccountNum where vendTrans.TransDate == fromDate { info(vendTrans.AccountNum); select AccountNum from vendTable where vendTable.AccountNum == vendTrans.AccountNum join Name from partyTable where partyTable.RecId == vendTable.Party join Locator from logisticsElectronicAddress where logisticsElectronicAddress.RecId == partyTable.PrimaryContactEmail; str email = logisticsElectronicAddress.Locator; SysMailerMessageBuilder mailer = new SysMailerMessageBuilder(); mailer.addTo(email); mailer.setSubject(strFmt("Payment Details - %1 %2", vendTable.AccountNum, partyTable.Name)); body = strFmt("Hi Dear %1
Vendor Account No. : %2
", partyTable.Name, vendTable.AccountNum); mailer.setBody(body, true); SysMailerFactory::sendNonInteractive(mailer.getMessage()); }
You have added the info log to account number. How many times that info is printing?
Also in the while select try adding order by vendTrans.AccountNum and check.
Thanks,
Girish S.
yes this is sending INMF01 to x1@gmail.com only that's correct but for INMF05 its sending mail to both x1@gmail.com and x2@gmail.com
So you are saying that INMF01 has x1@gmail.com and INMF05 has x2@gmail.com. But your code sending INMF05 to both x1@gmail.com and x2@gmail.com.
Is the above correct?
Thanks,
Girish S.
not working sir
Seems your code SysMailFactory will need to be inside the while select.
Move the SysMailFactory::getNonInteractiveMailer().sendNonIntercative(mailer.getMessage()) inside the while select and check.
Thanks,
Girish S.
André Arnaud de Cal...
291,969
Super User 2025 Season 1
Martin Dráb
230,842
Most Valuable Professional
nmaenpaa
101,156