Hi all,
in my todo card(form no. 5098). i have placed a send mail button.when iam clicking the send mail button...i need to send the current record which i entered in the form fields.
i've created a record datatype for (salesperson/purchaser card table) for picking the email id for the current salspersoncode enterd in the form(5098).plz take a look on the code...
when iam clicking the send mail button the attachment,to,cc..everything works fine..but entire report gets printed.....
i need the current record which i entered in the form(5098) fields to be send to the appropriate salesperson...
or
to send the report filtered with status (not started or in progres.....)
iam a newbie n help me with codes
using nav2009,classic client,sqlserver
IF ("No."<>'') THEN
BEGIN
IF "Salesperson Code" = recsalesper.Code THEN
recsalesper.RESET;
recsalesper.SETRANGE(recsalesper.Code,"Salesperson Code");
IF recsalesper.FIND('-') THEN
BEGIN
// sTo:='aaa@aaa.com';
sCC:='aaa@aaa.com';
sSubject:='sales report';
sMessage:='Hello';
// REPORT.RUNMODAL(REPORT::"Salesperson - To-dos",FALSE);
RptPath:='D:\myreport2.html';
SETFILTER(Status,'Not Started');//rec.setfilter
salperReport.SAVEASHTML(RptPath);
MailSent:=cMail.NewMessage(recsalesper."E-Mail",sCC,sSubject,sMessage,RptPath,TRUE);
IF MailSent THEN
MESSAGE('Mail sent successfully')
ELSE
ERROR('Mail sending failed');
END
END
Name DataType Subtype Length
recsalesper Record Salesperson/Purchaser
sCC Text 30
sSubject Text 30
sMessage Text 30
RptPath Text 30
MailSent Boolean
cMail Codeunit Mail
salperReport Report Salesperson - To-dos
0
Comments
Object Manager
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
just clarify......
i have to define recsalesper2 as datatype record and subtype salesper/pur table...
and where i have to place this code...coz again it not happens..
thanks..
" The salesperson -todo's report does not have a dataitem that uses the table(table13salesperson/pur..) specified in the function settable view"
IF ("No."<>'') THEN
BEGIN
IF "Salesperson Code" = recsalesper.Code THEN
recsalesper.RESET;
recsalesper.SETRANGE(recsalesper.Code,"Salesperson Code");
IF recsalesper.FIND('-') THEN
BEGIN
// sTo:='ramkumar@astralconsultants.com';
sCC:='ramkumar@astralconsultants.com';
sSubject:='sales report';
sMessage:='Hello';
// REPORT.RUNMODAL(REPORT::"Salesperson - To-dos",FALSE);
RptPath:='D:\myreport2.html';
SETFILTER(Status,'Not Started');
salperReport.SAVEASHTML(RptPath);
recsalesper2 := recsalesper;
recsalesper2.SETRECFILTER;
salperReport.SETTABLEVIEW(recsalesper2);
MailSent:=cMail.NewMessage(recsalesper."E-Mail",sCC,sSubject,sMessage,RptPath,TRUE);
IF MailSent THEN
MESSAGE('Mail sent successfully')
ELSE
ERROR('Mail sending failed');
END
END
Your report has probably the table to-do a first dataitem?
Then create a local var ToDo of type record table to-do and do the following:
Object Manager