Dear Friends ,
I need to send mail from AX,Birth day Greeting mail to the employees.
How can I develop below template and send as mail.
*This post is locked for comments
Dear Friends ,
I need to send mail from AX,Birth day Greeting mail to the employees.
How can I develop below template and send as mail.
*This post is locked for comments
Creating a batch job is one thing, and you can find plenty of help for that from the internet and from the community forums.
But here's how to get all DirPerson records who have birthday today:
DirPerson dirPerson; date todaysDate = systemDateGet(); Day birthDay = dayOfMth(todaysDate); MonthsOfYear birthMonth = mthOfYr(todaysDate); YearBase birthYear = year(todaysDate); while select dirPerson where dirPerson.BirthDay == birthDay && dirPerson.BirthMonth == birthMonth && dirPerson.BirthYear == birthYear { info(dirPerson.name); }
kindly send me Batch Job that checks for birthday each day.
Hi Friends,
I am able to send the Birthday greeting now with the help of Email Template.
1.I created one email-template
2.Added my HTML Image
3.I kept my jpg file at email parameters form,Folder location,I have given permissions to everyone for below folder.
4.Code To call this jpg file as HTML and pass as body of mail.
message = SysEmailMessageTable::find('Reminder', 'en-us'); mappings = new Map(Types::Container,Types::Container); ret = WebLet::weblets2Html4Help(SysEmailMessage::stringExpand(message.Mail, mappings), '');
Now I am able to see my birthday greeting at gmail and Client outlook.
Dear Crispin,
I saved my image at Sharepoint 2007 Picture library and that URL i am passing in img tag
txt ='<html><body><img src="mu-prodmsd-01/.../HBD.jpg"></body></html>';
reciepient user is also given permission for the file in share Point still in mail image is not coming
Please check my screen shots from share Point(which client uses for Enterprise Portal as well)
below is my compelet code
static void pwc_SendMailTest(Args _args)
{
PwC_ParseEmailTemplate parseEmailTemplate, parseEmailTemplate1, parseEmailTemplate2;
container parseEmailTemplate_1;
HRMParameters hrmParameters;
Email emplMail,mgrMail, fromEmail;
SysUserInfo sysUserInfo;
UserInfo userInfo;
str finalTo,finalCC,finalToAct;
Empltable empltable1,empltable2;
DirPartyTable dirpartytable1,dirpartytable2;
PwC_EmailTemplateParameter pwc_emailparm;
Date CurrDate = systemdateget();
PwC_employeeInfo txt,txt1, txt2, txt3;
str emailmessage, EmplId1;
HRPPartyPositionTableRelationShip hrpPartyPositionTableRelationShip;
HRMPartyEmployeeRelationship hrmPartyEmployeeRelationship;
PwC_EmplAdditionalFields pwc_EmplAdditionalFields;
//PwC_EmplTableDayMon t;
;
hrmParameters = HRMParameters::find();
parseEmailTemplate1 = new PwC_parseEmailTemplate(hrmParameters.PwC_EmailSetupTemplateId[20]);
txt1 = parseEmailTemplate1.getBody();
parseEmailTemplate2 = new PwC_parseEmailTemplate(hrmParameters.PwC_EmailSetupTemplateId[2]);
txt2 = parseEmailTemplate2.getBody();
// while select * from empltable1
// where empltable1.EmplId == '1008'
//{
// if(Mthofyr(empltable1.BirthDate)==mthofyr(Currdate)&&Dayofmth(empltable1.BirthDate)==dayofmth(CurrDate))
//{
select firstonly dirpartytable1
where dirpartytable1.PartyId==empltable1.PartyId;
select firstonly hrpPartyPositionTableRelationShip
where hrpPartyPositionTableRelationShip.Reference == emplTable1.EmplId;
select firstonly hrmPartyEmployeeRelationship
where hrmPartyEmployeeRelationship.EmplId == emplTable1.EmplId;
select firstonly pwc_EmplAdditionalFields
where pwc_EmplAdditionalFields.EmplId == emplTable1.EmplId;
parseEmailTemplate = new PwC_parseEmailTemplate(hrmParameters.PwC_EmailSetupTemplateId[21],[empltable1]);//, dirpartytable1, hrpPartyPositionTableRelationShip, hrmPartyEmployeeRelationship]);
// info(empltable1.EmplId);
// info(dirpartytable1.Name);
txt += parseEmailTemplate.getBody();
txt = '<html><body >   <table style="border:1px solid black;" >'+
'<tr> <td style="background-color:#FFF5EE"><i><font size="5" color="brown"><center><b>Wishing for a birthday that unfolds beautiful surprises'+
'</center></b></font></i><br/>'+
' <font size="5" color="brown"><b><i><center>and lots of happiness for you!</b></center></font></br></br> <font size="5" color="blue"><center><b><i>Have a day as special as you are!</center></font></br>'+
'</br><font size="4" color="red"><b><center><i>Happy Birthday to you!!</center></b></font></br></br><p>                               '+
'             <b>Priya P</b> '+
'                              <b>Poovendra Kumar V</b>    '+
'                                                  <b> Chandrakant Salunke</b>'+
'<BR />                              Facilities Management - Site              Facilities Management - Site'+
'                                          Facilities Management - Site</br>               '+
'                             Chennai'+
'                                        Bangalore'+
'                                                           '+
'              Mumbai</p>'+
'<br>                                    <b> Ashok Kumar H K</b>'+
'                                   <b> Ravindra Singh </b>'+
'<br />                               Facilities Management - Site'+
'                                  Finance'+
'<BR />                                          Bangalore'+
'                                                Gurgaon</td> </tr>'+
'<tr style="background-color:#AFEEEE" >                                        '+
'                                                          Human Resources </tr></table></body></html>'
;
txt ='<html><body><img src="http://mu-prodmsd-01:24319/PictureLibraryForShare/HBD.jpg"></body></html>';
//ead more: https://html.com/attributes/table-bordercolor/#ixzz5YpbbzXCE
if(parseEmailTemplate.getToList())
finalToAct = SysUserInfo::find(SysCompanyUserInfo::emplId2UserId(emplTable1.EmplID)).Email;
// finalto = 'singh.k.sanjay@in.pwc.com';
finalto = 'sanjay.1816@gmail.com';
finalto = 'Sudhirkant.Panda@in.knightfrank.com';
// finalto=parseEmailTemplate.getToList();
if(parseEmailTemplate.getCCAddress())
finalCC = parseEmailTemplate.getCCAddress();
txt3 = txt;
fromemail = 'msax@in.knightfrank.com';
if (finalto)
try
{
Global::pwCSendMail_kes(fromemail, [finalto], 'Test Mail(Please Ignore),Birthday Greetings', txt3);
info('Mail Sent');
}
catch (Exception::CLRError)
{
info ("Failed to Send Email some Error occure");
}
// }
// }
}
Hi,
Outlook Scenario Client is already using,
below is their feedback,
According to my understanding, Sudhir is doing the same manually(outlook), which is not acceptable to business and they wanted an automated process from master (Employee Master)data.
.....file:///C:/Users/sushri/Desktop/HBD.JPEG.... is a local path.
Batch will obviously not find this.. You have to specify a Network path here.
And here is an example community.dynamics.com/.../code-to-send-image-in-email-using-axapta-2012
body = <html><body bgcolor="red"><i><font size="3" color="brown"><center>Wishing for a birthday that unfolds beautiful surprises</center></font></i><br/>'+
' <font size="3" color="brown"><center>and lots of happiness for you!</center></font></br></br> <font size="3" color="blue"><center>Have a day as special as you are!</center></font></br>'+
'</br><IMG src="file:///C:/Users/sushri/Desktop/HBD.JPEG" width=50 height=50 ></body></html>';
This is the below body comes in email.But Image is not coming
I would rather not do this in my erp system, there are other options e.g.
https://flow.microsoft.com/en-us/galleries/public/templates/b6e38eb5fda442069ea2acf299a31d3e/send-a-happy-birthday-email-to-employees-on-their-birthday/ This uses a SharePoint list.
You can also use a word template with some bookmarks or use some VBA code and Outlook using an Outlook template.
For a semi manual process that is easy to set up when f you have everyone's birthday in your calendar then you will also get reminders. Your IT admin will in any case add new users to your email system so its not a lot of extra work to also add their birthday to Outlook - then it will recur every year,
Quite a few simple steps:
* A Batch Job that checks for birthday each day,
* append the Image using html
mailer.htmlBody(body); as you will find in this example community.dynamics.com/.../sending-email-using-x-code-dynamics-ax-2012
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,269 Super User 2024 Season 2
Martin Dráb 230,198 Most Valuable Professional
nmaenpaa 101,156