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);
Comments
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!