to send current form values
sathangai
Member Posts: 25
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
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
-
You must add a SETTABLEVIEW command before executing the report:
recsalesper2 := recsalesper; recsalesper2.SETRECFILTER; salperReport.SETTABLEVIEW(recsalesper2);
Reijer Molenaar
Object Manager0 -
[Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you reijermolenaar...
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..0 -
when iam running the form It throws me
" 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
END0 -
Ok, I get it.
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:ToDo := Rec; ToDo.SETRECFILTER; salperReport.SETTABLEVIEW(ToDo); salperReport.SAVEASHTML(RptPath);
Reijer Molenaar
Object Manager0 -
Thanks reijermolenaar..............now it's working.....agian thanks for ur valuble reply ...iam a anewbie and learning....this helps me a lot....0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
