Automatic Emailing by linking various tables

david.weeksdavid.weeks Member Posts: 96
edited 2004-02-26 in Navision Attain
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.

Comments

  • Dean_AxonDean_Axon Member Posts: 193
    Hi David,

    what kind of problem are you having ??
    Remember: Keep it simple
  • DenSterDenSter Member Posts: 8,307
    TechApproverEmail := LSalespersonEmail."E-Mail";
    LcduMail.NewMessage('TechApproverEmail','','Quote raised - Waiting for Technical Approval',"No.",'',FALSE);
    Take the single quotes away from your variable. So it should look like this:
    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.

    HTH
Sign In or Register to comment.