Automatic Emailing by linking various tables

david.weeks
Member Posts: 96
Hello All
I have created a new table that holds [no.] from table resource and two fields that are Technical and Commercial approver codes that links in with Salesperson/Purchaser table.
When pressing a command button I need to refer to a new function within OnPush and then use this to send an automatic email to all relevant email address for the Technical approver.
The new table that holds the approvers looks like:
Resource No. Tech App Comm App
RES0000028 DW TL
RES0000028 TL GB
RES0000028 DW GB
Therefore, within the function, I want to ensure that I check through the table for RES0000028 for example and send an email to DW and TL once each i.e. Not two emails to DW.
The code I have generated is as follows, but its not working......
Is there a glaring mistake or I have I approached this the wrong way?
LResourceSalesperson is the new table.
LSalespersonEmail is the Salesperson/Purchaser table.
LResourceSalesperson.SETRANGE("No._FK", ResourceType);
LResourceSalesperson.FIND('-');
REPEAT
IF TechApproverCode <> LResourceSalesperson.TechApprover THEN
TechApproverCode := LResourceSalesperson.TechApprover;
LSalespersonEmail.SETRANGE(Code, TechApproverCode);
LSalespersonEmail.FIND('-');
TechApproverEmail := LSalespersonEmail."E-Mail";
LcduMail.NewMessage('TechApproverEmail','','Quote raised - Waiting for Technical Approval',"No.",'',FALSE);
UNTIL LResourceSalesperson.NEXT = 0;
Any advice would be most appreciated. Thanks.
I have created a new table that holds [no.] from table resource and two fields that are Technical and Commercial approver codes that links in with Salesperson/Purchaser table.
When pressing a command button I need to refer to a new function within OnPush and then use this to send an automatic email to all relevant email address for the Technical approver.
The new table that holds the approvers looks like:
Resource No. Tech App Comm App
RES0000028 DW TL
RES0000028 TL GB
RES0000028 DW GB
Therefore, within the function, I want to ensure that I check through the table for RES0000028 for example and send an email to DW and TL once each i.e. Not two emails to DW.
The code I have generated is as follows, but its not working......
Is there a glaring mistake or I have I approached this the wrong way?
LResourceSalesperson is the new table.
LSalespersonEmail is the Salesperson/Purchaser table.
LResourceSalesperson.SETRANGE("No._FK", ResourceType);
LResourceSalesperson.FIND('-');
REPEAT
IF TechApproverCode <> LResourceSalesperson.TechApprover THEN
TechApproverCode := LResourceSalesperson.TechApprover;
LSalespersonEmail.SETRANGE(Code, TechApproverCode);
LSalespersonEmail.FIND('-');
TechApproverEmail := LSalespersonEmail."E-Mail";
LcduMail.NewMessage('TechApproverEmail','','Quote raised - Waiting for Technical Approval',"No.",'',FALSE);
UNTIL LResourceSalesperson.NEXT = 0;
Any advice would be most appreciated. Thanks.
0
Comments
-
Hi David,
what kind of problem are you having ??Remember: Keep it simple0 -
david.weeks wrote:TechApproverEmail := LSalespersonEmail."E-Mail";
LcduMail.NewMessage('TechApproverEmail','','Quote raised - Waiting for Technical Approval',"No.",'',FALSE);LcduMail.NewMessage(TechApproverEmail,'','Quote raised - Waiting for Technical Approval',"No.",'',FALSE);
You're filling the variable TechApproverEmail with an email address, and this is already a string, so you don't need the single quotes to pass it into the Mail codeunit.
HTH0
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
- 320 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