Eship/Email Setup

SavatageSavatage Member Posts: 7,142
edited 2006-01-13 in Navision Attain
Using the email feature that came with Eship is great. But I (and I guess everyone else) really just used it (if you even did) for sending invoices or confirmations or whatever.

Today I've been toying with send PO's using this method - yes PDF is easier (anyway) As far as it working for Vendors-IT DOESN't

See code
OnDelete()
EMailCommentLine.RESET;
EMailCommentLine.SETRANGE("Table ID",DATABASE::"E-Mail Attachment");
EMailCommentLine.SETRANGE(Code,Code);
EMailCommentLine.DELETEALL;

LookupComment()
EMailCommentLine.RESET;
EMailCommentLine.SETRANGE("Table ID",DATABASE::"E-Mail Attachment");
EMailCommentLine.SETRANGE(Code,Code);
CLEAR(EMailComment);
EMailComment.SETTABLEVIEW(EMailCommentLine);
EMailComment.RUNMODAL;

GetEMailRule(Type : 'Customer,Vendor';No : Code[20];ShipToCode : Code[20]) : Boolean
CASE Type OF
  Type::Customer:
    BEGIN
      IF ShipToCode <> '' THEN BEGIN
        ShipToAddress.GET(No,ShipToCode);
        SendMail := GET(ShipToAddress."E-Mail Rule Code");
        IF NOT SendMail THEN BEGIN
          Customer.GET(No);
          IF Customer."Use E-Mail Rule for ShipToAddr" THEN
            SendMail := GET(Customer."E-Mail Rule Code");
        END;
      END ELSE BEGIN
        Customer.GET(No);
        SendMail := GET(Customer."E-Mail Rule Code");
      END;
    END;
  Type::Vendor:
    BEGIN
      IF ShipToCode <> '' THEN BEGIN
        OrderAddress.GET(No,ShipToCode);
        SendMail := GET(OrderAddress."E-Mail Rule Code");
        IF NOT SendMail THEN BEGIN
          Vendor.GET(No);
          IF Vendor."Use E-Mail Rule for Order Addr" THEN
            SendMail := GET(Vendor."E-Mail Rule Code");
        END;
      END ELSE BEGIN
        Vendor.GET(No);
        SendMail := GET(Vendor."E-Mail Rule Code");
      END;
    END;
END;

IF NOT SendMail THEN BEGIN
  EMailSetup.GET;
  SendMail := GET(EMailSetup."Default E-Mail Rule");
END;

EXIT(SendMail);

The part in questions is CASE Type OF
Type::Customer: in get emailrule.

It's never going to run the "Vendor" code cause this TYPE is nowhere to be found. It's not pulling this info from anywhere & if it was Ship-to's? Sorry my Ship-To Address Table doesn't even support Vendors.

Anybody else try this?

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Hi Harry,

    I don;t understand what you mean with TYPE.

    If this is compiling C/AL code, the type vendor should exist, otherwise you get a compile error.

    As for the ship-to address, if you read the code, it should use orderadress for vendors, not ship-to address. You can read in the variables what table this is.

    If there is no documentation available about how to use this for vendors you can use a rough reversed engineering method. Delete this function and compile all objects. Then every point that reffers to this function will not compile :-s

    Off course you need to do this in a copy of the database that you can discard after this action.

    Good luck!
Sign In or Register to comment.